diff options
| author | zeertzjq <zeertzjq@outlook.com> | 2022-03-28 04:43:51 +0800 |
|---|---|---|
| committer | zeertzjq <zeertzjq@outlook.com> | 2022-03-28 06:15:26 +0800 |
| commit | 4baeb96c1bb66c845b4bc58482df4e601485eec3 (patch) | |
| tree | 4a6bfbead593d25778826ceababf2d3222a51783 /src/nvim/move.c | |
| parent | a201dd265f3f20be954d8b7ee7f65d3eb6f920f6 (diff) | |
| download | rneovim-4baeb96c1bb66c845b4bc58482df4e601485eec3.tar.gz rneovim-4baeb96c1bb66c845b4bc58482df4e601485eec3.tar.bz2 rneovim-4baeb96c1bb66c845b4bc58482df4e601485eec3.zip | |
vim-patch:8.2.4638: superfluous check if a redraw is needed for 'cursorline'
Problem: Superfluous check if a redraw is needed for 'cursorline'.
Solution: Remove check_redraw_cursorline(). (closes vim/vim#10030, closes vim/vim#10029)
https://github.com/vim/vim/commit/3e559cd88486ffab6b6fb4e0921b4600d137a617
redraw_after_callback() is N/A.
Omits changes that just revert code from patch 8.2.4630.
Diffstat (limited to 'src/nvim/move.c')
| -rw-r--r-- | src/nvim/move.c | 29 |
1 files changed, 19 insertions, 10 deletions
diff --git a/src/nvim/move.c b/src/nvim/move.c index 751e0046bc..9b35a7da0a 100644 --- a/src/nvim/move.c +++ b/src/nvim/move.c @@ -95,7 +95,7 @@ static void comp_botline(win_T *wp) win_check_anchored_floats(wp); } -// Redraw when w_cline_row changes and 'relativenumber' or 'cursorline' is set. +/// Redraw when w_cline_row changes and 'relativenumber' or 'cursorline' is set. void redraw_for_cursorline(win_T *wp) FUNC_ATTR_NONNULL_ALL { @@ -107,6 +107,22 @@ void redraw_for_cursorline(win_T *wp) } } +/// Redraw when w_virtcol changes and 'cursorcolumn' is set or 'cursorlineopt' +/// contains "screenline". +static void redraw_for_cursorcolumn(win_T *wp) + FUNC_ATTR_NONNULL_ALL +{ + if ((wp->w_valid & VALID_VIRTCOL) == 0 && !pum_visible()) { + if (wp->w_p_cuc) { + // When 'cursorcolumn' is set need to redraw with SOME_VALID. + redraw_later(wp, SOME_VALID); + } else if (wp->w_p_cul && (wp->w_p_culopt_flags & CULOPT_SCRLINE)) { + // When 'cursorlineopt' contains "screenline" need to redraw with VALID. + redraw_later(wp, VALID); + } + } +} + /* * Update curwin->w_topline and redraw if necessary. * Used to update the screen before printing a message. @@ -623,11 +639,8 @@ void validate_virtcol_win(win_T *wp) check_cursor_moved(wp); if (!(wp->w_valid & VALID_VIRTCOL)) { getvvcol(wp, &wp->w_cursor, NULL, &(wp->w_virtcol), NULL); + redraw_for_cursorcolumn(wp); wp->w_valid |= VALID_VIRTCOL; - if (wp->w_p_cuc - && !pum_visible()) { - redraw_later(wp, SOME_VALID); - } } } @@ -930,11 +943,7 @@ void curs_columns(win_T *wp, int may_scroll) redraw_later(wp, NOT_VALID); } - // Redraw when w_virtcol changes and 'cursorcolumn' is set - if (wp->w_p_cuc && (wp->w_valid & VALID_VIRTCOL) == 0 - && !pum_visible()) { - redraw_later(wp, SOME_VALID); - } + redraw_for_cursorcolumn(curwin); // now w_leftcol is valid, avoid check_cursor_moved() thinking otherwise wp->w_valid_leftcol = wp->w_leftcol; |