diff options
author | zeertzjq <zeertzjq@outlook.com> | 2024-02-08 19:37:41 +0800 |
---|---|---|
committer | GitHub <noreply@github.com> | 2024-02-08 19:37:41 +0800 |
commit | 8b21fe83daf5e04afda6a2edf91e9258530124d8 (patch) | |
tree | 3e3d5ea83be6645989097e75ef3e88cf87c02583 /src/nvim/change.c | |
parent | 1f9da3d0835af2cfe937de250c2cde3a59e1677e (diff) | |
parent | da3facb7eea92bd4082bb6ea12e0947580a63962 (diff) | |
download | rneovim-8b21fe83daf5e04afda6a2edf91e9258530124d8.tar.gz rneovim-8b21fe83daf5e04afda6a2edf91e9258530124d8.tar.bz2 rneovim-8b21fe83daf5e04afda6a2edf91e9258530124d8.zip |
Merge pull request #27388 from zeertzjq/vim-9.1.0082
vim-patch:9.1.{0082,0083}: redrawing can be improved
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; } } } |