diff options
author | Lewis Russell <lewis6991@gmail.com> | 2022-03-29 12:37:42 +0100 |
---|---|---|
committer | GitHub <noreply@github.com> | 2022-03-29 19:37:42 +0800 |
commit | 81d7628c3fadaa72b879b5e934d30c609d7c89f8 (patch) | |
tree | de41b4fff79b958f66c94b8b59c39758585892c6 /src/nvim/screen.c | |
parent | d89a80fafc6cdf12f72dac2bcbd5055038a241dc (diff) | |
download | rneovim-81d7628c3fadaa72b879b5e934d30c609d7c89f8.tar.gz rneovim-81d7628c3fadaa72b879b5e934d30c609d7c89f8.tar.bz2 rneovim-81d7628c3fadaa72b879b5e934d30c609d7c89f8.zip |
vim-patch:8.2.4644: redrawing too often when 'relativenumber' is set (#17756)
Problem: Redrawing too often when 'relativenumber' is set.
Solution: Only redraw when the cursor line changed. (Lewis Russell,
closes vim/vim#10040)
https://github.com/vim/vim/commit/1624639ec8a6c3c99e417a2990f2f02f0d0b6e10
Diffstat (limited to 'src/nvim/screen.c')
-rw-r--r-- | src/nvim/screen.c | 8 |
1 files changed, 5 insertions, 3 deletions
diff --git a/src/nvim/screen.c b/src/nvim/screen.c index 67eee55c51..48f00e1a6a 100644 --- a/src/nvim/screen.c +++ b/src/nvim/screen.c @@ -1577,9 +1577,9 @@ static void win_update(win_T *wp, DecorProviders *providers) idx++; lnum += foldinfo.fi_lines + 1; } else { - if (wp->w_p_rnu) { - // 'relativenumber' set: The text doesn't need to be drawn, but - // the number column nearly always does. + 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. foldinfo_T info = fold_info(wp, lnum); (void)win_line(wp, lnum, srow, wp->w_grid.Rows, true, true, info, &line_providers); @@ -1607,6 +1607,8 @@ static void win_update(win_T *wp, DecorProviders *providers) // update w_last_cursorline. wp->w_last_cursorline = cursorline_standout ? wp->w_cursor.lnum : 0; + wp->w_last_cursor_lnum_rnu = wp->w_p_rnu ? wp->w_cursor.lnum : 0; + if (idx > wp->w_lines_valid) { wp->w_lines_valid = idx; } |