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

@@ -381,7 +381,7 @@ static void insert_enter(InsertState *s)
// Need to recompute the cursor position, it might move when the cursor is
// on a TAB or special character.
curs_columns(true);
curs_columns(curwin, true);
// Enable langmap or IME, indicated by 'iminsert'.
// Note that IME may enabled/disabled without us noticing here, thus the
@@ -608,7 +608,7 @@ static int insert_check(VimState *state)
}
// May need to adjust w_topline to show the cursor.
update_topline();
update_topline(curwin);
s->did_backspace = false;
@@ -1561,7 +1561,7 @@ void edit_putchar(int c, bool highlight)
int attr;
if (curwin->w_grid.chars != NULL || default_grid.chars != NULL) {
update_topline(); // just in case w_topline isn't valid
update_topline(curwin); // just in case w_topline isn't valid
validate_cursor();
if (highlight) {
attr = HL_ATTR(HLF_8);
@@ -1677,7 +1677,7 @@ void display_dollar(colnr_T col)
// If on the last byte of a multi-byte move to the first byte.
char_u *p = get_cursor_line_ptr();
curwin->w_cursor.col -= utf_head_off(p, p + col);
curs_columns(false); // Recompute w_wrow and w_wcol
curs_columns(curwin, false); // Recompute w_wrow and w_wcol
if (curwin->w_wcol < curwin->w_grid.Columns) {
edit_putchar('$', false);
dollar_vcol = curwin->w_virtcol;
@@ -5328,7 +5328,7 @@ static int ins_complete(int c, bool enable_pum)
edit_submode_extra = match_ref;
edit_submode_highl = HLF_R;
if (dollar_vcol >= 0)
curs_columns(FALSE);
curs_columns(curwin, false);
}
}
}
@@ -6158,7 +6158,7 @@ internal_format (
curwin->w_p_lbr = has_lbr;
if (!format_only && haveto_redraw) {
update_topline();
update_topline(curwin);
redraw_curbuf_later(VALID);
}
}
@@ -6807,7 +6807,7 @@ cursor_up (
coladvance(curwin->w_curswant);
if (upd_topline) {
update_topline(); // make sure curwin->w_topline is valid
update_topline(curwin); // make sure curwin->w_topline is valid
}
return OK;
@@ -6858,7 +6858,7 @@ cursor_down (
coladvance(curwin->w_curswant);
if (upd_topline) {
update_topline(); // make sure curwin->w_topline is valid
update_topline(curwin); // make sure curwin->w_topline is valid
}
return OK;