aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorzeertzjq <zeertzjq@outlook.com>2024-11-26 22:55:05 +0800
committerGitHub <noreply@github.com>2024-11-26 14:55:05 +0000
commite8450ef2368bd2d80149bf98a34571bc92fb2aba (patch)
tree41610c6f405deb7b89fd051766bccd49801a5679
parent3d707e6f14b7db64b3510f58bf9321c71163f552 (diff)
downloadrneovim-e8450ef2368bd2d80149bf98a34571bc92fb2aba.tar.gz
rneovim-e8450ef2368bd2d80149bf98a34571bc92fb2aba.tar.bz2
rneovim-e8450ef2368bd2d80149bf98a34571bc92fb2aba.zip
vim-patch:9.1.0889: Possible unnecessary redraw after adding/deleting lines (#31356)
Problem: Possible unnecessary redraw after adding/deleting lines. Solution: Check b_mod_set before using b_mod_xlines to avoid using stale b_mod_xlines value (zeertzjq). closes: vim/vim#16124 https://github.com/vim/vim/commit/9f25a3a237156889df3df78dbd8f12ee6059e332
-rw-r--r--src/nvim/drawscreen.c5
1 files changed, 3 insertions, 2 deletions
diff --git a/src/nvim/drawscreen.c b/src/nvim/drawscreen.c
index 19a8093a16..e645d1bbea 100644
--- a/src/nvim/drawscreen.c
+++ b/src/nvim/drawscreen.c
@@ -2072,7 +2072,7 @@ static void win_update(win_T *wp)
// match in fixed position might need redraw
// if lines were inserted or deleted
|| (wp->w_match_head != NULL
- && buf->b_mod_xlines != 0)))))
+ && buf->b_mod_set && buf->b_mod_xlines != 0)))))
|| lnum == wp->w_cursorline
|| lnum == wp->w_last_cursorline) {
if (lnum == mod_top) {
@@ -2291,7 +2291,8 @@ static void win_update(win_T *wp)
// - '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)
+ if ((wp->w_p_nu && mod_top != 0 && lnum >= mod_bot
+ && buf->b_mod_set && 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);