summaryrefslogtreecommitdiffstats
path: root/src/drawscreen.c
diff options
context:
space:
mode:
authorzeertzjq <zeertzjq@outlook.com>2024-02-08 11:37:40 +0100
committerChristian Brabandt <cb@256bit.org>2024-02-08 11:37:40 +0100
commitae07ebc04b0726e12b1af39d52e01d86ae79ef0a (patch)
tree4496e0d5e633018ae1a8711d1c6c7cbfdd555035 /src/drawscreen.c
parent7ce34c9a947b17a8b5e81e7c2335a63552182d10 (diff)
patch 9.1.0083: Redrawing can be improved when deleting lines with 'number'v9.1.0083
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: #13985 Signed-off-by: zeertzjq <zeertzjq@outlook.com> Signed-off-by: Christian Brabandt <cb@256bit.org>
Diffstat (limited to 'src/drawscreen.c')
-rw-r--r--src/drawscreen.c16
1 files changed, 8 insertions, 8 deletions
diff --git a/src/drawscreen.c b/src/drawscreen.c
index 960bd69118..d1773701da 100644
--- a/src/drawscreen.c
+++ b/src/drawscreen.c
@@ -1699,11 +1699,6 @@ win_update(win_T *wp)
top_end = 1;
#endif
}
-
- // 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
wp->w_redraw_bot = 0;
@@ -2540,11 +2535,16 @@ win_update(win_T *wp)
}
else
{
- if (wp->w_p_rnu && wp->w_last_cursor_lnum_rnu != wp->w_cursor.lnum)
+ // 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))
{
#ifdef FEAT_FOLDING
- // 'relativenumber' set and the cursor moved vertically: The
- // text doesn't need to be drawn, but the number column does.
fold_count = foldedCount(wp, lnum, &win_foldinfo);
if (fold_count != 0)
fold_line(wp, fold_count, &win_foldinfo, lnum, row);