diff options
author | zeertzjq <zeertzjq@outlook.com> | 2024-02-08 19:10:27 +0800 |
---|---|---|
committer | zeertzjq <zeertzjq@outlook.com> | 2024-02-08 19:20:07 +0800 |
commit | da3facb7eea92bd4082bb6ea12e0947580a63962 (patch) | |
tree | 3e3d5ea83be6645989097e75ef3e88cf87c02583 /src | |
parent | 1c2b9e8dd8c3fba1ac8f45aef476d6933c9e7017 (diff) | |
download | rneovim-da3facb7eea92bd4082bb6ea12e0947580a63962.tar.gz rneovim-da3facb7eea92bd4082bb6ea12e0947580a63962.tar.bz2 rneovim-da3facb7eea92bd4082bb6ea12e0947580a63962.zip |
vim-patch:9.1.0083: Redrawing can be improved when deleting lines with 'number'
Problem: Redrawing can be improved when inserting/deleting lines with 'number'.
Solution: Only redraw the number column of lines below changed lines.
Add a test as this wasn't previously tested.
(zeertzjq)
closes: vim/vim#13985
https://github.com/vim/vim/commit/ae07ebc04b0726e12b1af39d52e01d86ae79ef0a
Diffstat (limited to 'src')
-rw-r--r-- | src/nvim/drawscreen.c | 15 |
1 files changed, 6 insertions, 9 deletions
diff --git a/src/nvim/drawscreen.c b/src/nvim/drawscreen.c index f23c0a0fd3..3d048d178e 100644 --- a/src/nvim/drawscreen.c +++ b/src/nvim/drawscreen.c @@ -1643,12 +1643,6 @@ static void win_update(win_T *wp) top_end = 1; } } - - // When line numbers are displayed need to redraw all lines below - // inserted/deleted lines. - if (mod_top != 0 && buf->b_mod_xlines != 0 && wp->w_p_nu) { - mod_bot = MAXLNUM; - } } wp->w_redraw_top = 0; // reset for next time @@ -2326,9 +2320,12 @@ static void win_update(win_T *wp) idx++; lnum += foldinfo.fi_lines + 1; } else { - if (wp->w_p_rnu && wp->w_last_cursor_lnum_rnu != wp->w_cursor.lnum) { - // 'relativenumber' set and cursor moved vertically: The - // text doesn't need to be drawn, but the number column does. + // If: + // - 'number' is set and below inserted/deleted lines, or + // - 'relativenumber' is set and cursor moved vertically, + // the text doesn't need to be redrawn, but the number column does. + if ((wp->w_p_nu && mod_top != 0 && lnum >= mod_bot && buf->b_mod_xlines != 0) + || (wp->w_p_rnu && wp->w_last_cursor_lnum_rnu != wp->w_cursor.lnum)) { foldinfo_T info = wp->w_p_cul && lnum == wp->w_cursor.lnum ? cursorline_fi : fold_info(wp, lnum); win_line(wp, lnum, srow, wp->w_grid.rows, wp->w_lines[idx].wl_size, &spv, info); |