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-operators.c | 7 +++---- 1 file changed, 3 insertions(+), 4 deletions(-) (limited to 'vis-operators.c') diff --git a/vis-operators.c b/vis-operators.c index 5ce64c4..59abcf6 100644 --- a/vis-operators.c +++ b/vis-operators.c @@ -102,7 +102,7 @@ static size_t op_put(Vis *vis, Text *txt, OperatorContext *c) { static size_t op_shift_right(Vis *vis, Text *txt, OperatorContext *c) { char spaces[9] = " "; - spaces[MIN(vis->win->view->tabwidth, LENGTH(spaces) - 1)] = '\0'; + spaces[MIN(vis->win->view.tabwidth, LENGTH(spaces) - 1)] = '\0'; const char *tab = vis->win->expandtab ? spaces : "\t"; size_t tablen = strlen(tab); size_t pos = text_line_begin(txt, c->range.end), prev_pos; @@ -127,7 +127,7 @@ static size_t op_shift_right(Vis *vis, Text *txt, OperatorContext *c) { static size_t op_shift_left(Vis *vis, Text *txt, OperatorContext *c) { size_t pos = text_line_begin(txt, c->range.end), prev_pos; - size_t tabwidth = vis->win->view->tabwidth, tablen; + size_t tabwidth = vis->win->view.tabwidth, tablen; size_t newpos = c->pos; /* if range ends at the begin of a line, skip line break */ @@ -161,7 +161,6 @@ static size_t op_shift_left(Vis *vis, Text *txt, OperatorContext *c) { } static size_t op_cursor(Vis *vis, Text *txt, OperatorContext *c) { - View *view = vis->win->view; Filerange r = text_range_linewise(txt, &c->range); for (size_t line = text_range_line_first(txt, &r); line != EPOS; line = text_range_line_next(txt, &r, line)) { size_t pos; @@ -169,7 +168,7 @@ static size_t op_cursor(Vis *vis, Text *txt, OperatorContext *c) { pos = text_line_finish(txt, line); else pos = text_line_start(txt, line); - view_selections_new_force(view, pos); + view_selections_new_force(&vis->win->view, pos); } return EPOS; } -- cgit v1.2.3