diff options
author | zeertzjq <zeertzjq@outlook.com> | 2022-03-23 11:28:32 +0800 |
---|---|---|
committer | zeertzjq <zeertzjq@outlook.com> | 2022-03-24 16:08:59 +0800 |
commit | c29a14d1fa58d5472bd14fec99c5b4228ed38b24 (patch) | |
tree | d17bb2d17d37dae688b4149b7a6a365889f9d9e0 /src/nvim/move.c | |
parent | 3e9b4e917d0783d0414192c3ad231cfcb813e73f (diff) | |
download | rneovim-c29a14d1fa58d5472bd14fec99c5b4228ed38b24.tar.gz rneovim-c29a14d1fa58d5472bd14fec99c5b4228ed38b24.tar.bz2 rneovim-c29a14d1fa58d5472bd14fec99c5b4228ed38b24.zip |
perf(screen): reduce cursorline redrawing when jumping around
vim-patch:8.2.4614: redrawing too much when 'cursorline' is set
Problem: Redrawing too much when 'cursorline' is set and jumping around.
Solution: Rely on win_update() to redraw the current and previous cursor
line, do not mark lines as modified. (closes vim/vim#9996)
https://github.com/vim/vim/commit/c20e46a4e3efcd408ef132872238144ea34f7ae5
This doesn't match the patch exactly, because I missed some lines when
porting patch 8.1.2029, and these lines were removed in this patch.
This also makes win_update() always update for 'concealcursor' like how
it always updates for 'cursorline', as 'cursorline' and 'concealcursor'
redrawing logic has been unified in Nvim.
As redrawing for 'cursorline' now always only requires VALID redraw
type, it is no longer necessary to call redraw_for_cursorline() in
nvim_win_set_cursor().
Diffstat (limited to 'src/nvim/move.c')
-rw-r--r-- | src/nvim/move.c | 22 |
1 files changed, 2 insertions, 20 deletions
diff --git a/src/nvim/move.c b/src/nvim/move.c index 27cc2b341c..751e0046bc 100644 --- a/src/nvim/move.c +++ b/src/nvim/move.c @@ -95,11 +95,6 @@ static void comp_botline(win_T *wp) win_check_anchored_floats(wp); } -void reset_cursorline(void) -{ - curwin->w_last_cursorline = 0; -} - // Redraw when w_cline_row changes and 'relativenumber' or 'cursorline' is set. void redraw_for_cursorline(win_T *wp) FUNC_ATTR_NONNULL_ALL @@ -107,21 +102,8 @@ void redraw_for_cursorline(win_T *wp) if ((wp->w_p_rnu || win_cursorline_standout(wp)) && (wp->w_valid & VALID_CROW) == 0 && !pum_visible()) { - if (wp->w_p_rnu) { - // win_line() will redraw the number column only. - redraw_later(wp, VALID); - } - if (win_cursorline_standout(wp)) { - if (wp->w_redr_type <= VALID && wp->w_last_cursorline != 0) { - // "w_last_cursorline" may be outdated, worst case we redraw - // too much. This is optimized for moving the cursor around in - // the current window. - redrawWinline(wp, wp->w_last_cursorline); - redrawWinline(wp, wp->w_cursor.lnum); - } else { - redraw_later(wp, SOME_VALID); - } - } + // win_line() will redraw the number column and cursorline only. + redraw_later(wp, VALID); } } |