refactor: de-curwin-ify update_topline/curs_columns

This commit is contained in:
Matthieu Coudron
2020-12-23 16:53:35 +01:00
parent 4d9520ec86
commit 45166313cc
13 changed files with 221 additions and 215 deletions

View File

@@ -1261,7 +1261,7 @@ static void normal_redraw(NormalState *s)
{
// Before redrawing, make sure w_topline is correct, and w_leftcol
// if lines don't wrap, and w_skipcol if lines wrap.
update_topline();
update_topline(curwin);
validate_cursor();
// If the cursor moves horizontally when 'concealcursor' is active, then the
@@ -1341,7 +1341,7 @@ static int normal_check(VimState *state)
} else if (do_redraw || stuff_empty()) {
// Need to make sure w_topline and w_leftcol are correct before
// normal_check_window_scrolled() is called.
update_topline();
update_topline(curwin);
normal_check_cursor_moved(s);
normal_check_text_changed(s);
@@ -4254,7 +4254,7 @@ dozet:
case '+':
if (cap->count0 == 0) {
/* No count given: put cursor at the line below screen */
validate_botline(); /* make sure w_botline is valid */
validate_botline(curwin); /* make sure w_botline is valid */
if (curwin->w_botline > curbuf->b_ml.ml_line_count)
curwin->w_cursor.lnum = curbuf->b_ml.ml_line_count;
else
@@ -5053,7 +5053,7 @@ static void nv_scroll(cmdarg_T *cap)
setpcmark();
if (cap->cmdchar == 'L') {
validate_botline(); /* make sure curwin->w_botline is valid */
validate_botline(curwin); /* make sure curwin->w_botline is valid */
curwin->w_cursor.lnum = curwin->w_botline - 1;
if (cap->count1 - 1 >= curwin->w_cursor.lnum)
curwin->w_cursor.lnum = 1;
@@ -5074,7 +5074,7 @@ static void nv_scroll(cmdarg_T *cap)
/* Don't count filler lines above the window. */
used -= diff_check_fill(curwin, curwin->w_topline)
- curwin->w_topfill;
validate_botline(); // make sure w_empty_rows is valid
validate_botline(curwin); // make sure w_empty_rows is valid
half = (curwin->w_height_inner - curwin->w_empty_rows + 1) / 2;
for (n = 0; curwin->w_topline + n < curbuf->b_ml.ml_line_count; n++) {
// Count half he number of filler lines to be "below this
@@ -6653,7 +6653,7 @@ static void nv_g_cmd(cmdarg_T *cap)
VIsual = curwin->w_cursor;
curwin->w_cursor = tpos;
check_cursor();
update_topline();
update_topline(curwin);
/*
* When called from normal "g" command: start Select mode when
* 'selectmode' contains "cmd". When called for K_SELECT, always