aboutsummaryrefslogtreecommitdiff
path: root/vis-modes.c
diff options
context:
space:
mode:
authorRandy Palamar <randy@rnpnr.xyz>2024-05-21 11:27:08 -0600
committerRandy Palamar <randy@rnpnr.xyz>2024-05-21 20:21:46 -0600
commit7554ecd77efc29601b7b44deca602724917ce019 (patch)
tree9e8e7d0ca7f0b173f98c224a25f6f626dcece8ac /vis-modes.c
parent7e85064ac77ea43e84d88eb910b0adb6f07d5d12 (diff)
downloadvis-7554ecd77efc29601b7b44deca602724917ce019.tar.gz
vis-7554ecd77efc29601b7b44deca602724917ce019.tar.xz
remove some view pointer chasing
Same as previous commit each window only has a single View. No need for it to be stored elsewhere in memory.
Diffstat (limited to 'vis-modes.c')
-rw-r--r--vis-modes.c12
1 files changed, 6 insertions, 6 deletions
diff --git a/vis-modes.c b/vis-modes.c
index 41121a8..f6d2b26 100644
--- a/vis-modes.c
+++ b/vis-modes.c
@@ -148,7 +148,7 @@ static void vis_mode_normal_enter(Vis *vis, Mode *old) {
return;
if (vis->autoindent && strcmp(vis->key_prev, "<Enter>") == 0) {
Text *txt = win->file->text;
- for (Selection *s = view_selections(win->view); s; s = view_selections_next(s)) {
+ for (Selection *s = view_selections(&win->view); s; s = view_selections_next(s)) {
size_t pos = view_cursors_pos(s);
size_t start = text_line_start(txt, pos);
size_t end = text_line_end(txt, pos);
@@ -189,7 +189,7 @@ static void vis_mode_operator_input(Vis *vis, const char *str, size_t len) {
static void vis_mode_visual_enter(Vis *vis, Mode *old) {
Win *win = vis->win;
if (!old->visual && win) {
- for (Selection *s = view_selections(win->view); s; s = view_selections_next(s))
+ for (Selection *s = view_selections(&win->view); s; s = view_selections_next(s))
s->anchored = true;
}
}
@@ -197,7 +197,7 @@ static void vis_mode_visual_enter(Vis *vis, Mode *old) {
static void vis_mode_visual_line_enter(Vis *vis, Mode *old) {
Win *win = vis->win;
if (!old->visual && win) {
- for (Selection *s = view_selections(win->view); s; s = view_selections_next(s))
+ for (Selection *s = view_selections(&win->view); s; s = view_selections_next(s))
s->anchored = true;
}
if (!vis->action.op)
@@ -211,9 +211,9 @@ static void vis_mode_visual_line_leave(Vis *vis, Mode *new) {
if (!new->visual) {
if (!vis->action.op)
window_selection_save(win);
- view_selections_clear_all(win->view);
+ view_selections_clear_all(&win->view);
} else {
- view_cursors_to(win->view->selection, view_cursor_get(win->view));
+ view_cursors_to(win->view.selection, view_cursor_get(&win->view));
}
}
@@ -222,7 +222,7 @@ static void vis_mode_visual_leave(Vis *vis, Mode *new) {
if (!new->visual && win) {
if (!vis->action.op)
window_selection_save(win);
- view_selections_clear_all(win->view);
+ view_selections_clear_all(&win->view);
}
}