diff options
author | zeertzjq <zeertzjq@outlook.com> | 2024-02-08 19:07:59 +0800 |
---|---|---|
committer | zeertzjq <zeertzjq@outlook.com> | 2024-02-08 19:20:07 +0800 |
commit | 1c2b9e8dd8c3fba1ac8f45aef476d6933c9e7017 (patch) | |
tree | 841f1265a6cb61e0bb41c6915cb46af7a2c4e01e /src/nvim/change.c | |
parent | 1f9da3d0835af2cfe937de250c2cde3a59e1677e (diff) | |
download | rneovim-1c2b9e8dd8c3fba1ac8f45aef476d6933c9e7017.tar.gz rneovim-1c2b9e8dd8c3fba1ac8f45aef476d6933c9e7017.tar.bz2 rneovim-1c2b9e8dd8c3fba1ac8f45aef476d6933c9e7017.zip |
vim-patch:9.1.0082: Redrawing can be improved when deleting lines with 'cursorline'
Problem: Redrawing can be improved when deleting lines with 'cursorline'.
Solution: Use smarter invalidation and adjustment. Remove unnecessary
UPD_VALID as it is already set at the top of the loop. Make
the test for vim/vim#4862 fail without the fix.
(zeertzjq)
closes: vim/vim#13986
https://github.com/vim/vim/commit/7ce34c9a947b17a8b5e81e7c2335a63552182d10
Diffstat (limited to 'src/nvim/change.c')
-rw-r--r-- | src/nvim/change.c | 19 |
1 files changed, 9 insertions, 10 deletions
diff --git a/src/nvim/change.c b/src/nvim/change.c index fa098a3220..e0b5822233 100644 --- a/src/nvim/change.c +++ b/src/nvim/change.c @@ -353,20 +353,19 @@ static void changed_common(buf_T *buf, linenr_T lnum, colnr_T col, linenr_T lnum } // If lines have been added or removed, relative numbering always - // requires a redraw. + // requires an update even if cursor didn't move. if (wp->w_p_rnu && xtra != 0) { wp->w_last_cursor_lnum_rnu = 0; - redraw_later(wp, UPD_VALID); } - // Cursor line highlighting probably need to be updated with - // "UPD_VALID" if it's below the change. - // If the cursor line is inside the change we need to redraw more. - if (wp->w_p_cul) { - if (xtra == 0) { - redraw_later(wp, UPD_VALID); - } else if (lnum <= wp->w_last_cursorline) { - redraw_later(wp, UPD_SOME_VALID); + if (wp->w_p_cul && wp->w_last_cursorline >= lnum) { + if (wp->w_last_cursorline < lnume) { + // If 'cursorline' was inside the change, it has already + // been invalidated in w_lines[] by the loop above. + wp->w_last_cursorline = 0; + } else { + // If 'cursorline' was below the change, adjust its lnum. + wp->w_last_cursorline += xtra; } } } |