From 7554ecd77efc29601b7b44deca602724917ce019 Mon Sep 17 00:00:00 2001 From: Randy Palamar Date: Tue, 21 May 2024 11:27:08 -0600 Subject: 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. --- vis-modes.c | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-) (limited to 'vis-modes.c') 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, "") == 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); } } -- cgit v1.2.3