summaryrefslogtreecommitdiffstats
path: root/src
diff options
context:
space:
mode:
authorLewis Russell <lewis6991@gmail.com>2022-03-29 11:38:17 +0100
committerBram Moolenaar <Bram@vim.org>2022-03-29 11:38:17 +0100
commit1624639ec8a6c3c99e417a2990f2f02f0d0b6e10 (patch)
tree108c6915932564f48432e6c5f56d04653597d180 /src
parent24565cf27bc28cbd73f10e5ddf1e4ef53038a426 (diff)
patch 8.2.4644: redrawing too often when 'relativenumber' is setv8.2.4644
Problem: Redrawing too often when 'relativenumber' is set. Solution: Only redraw when the cursor line changed. (Lewis Russell, closes #10040)
Diffstat (limited to 'src')
-rw-r--r--src/change.c2
-rw-r--r--src/drawscreen.c7
-rw-r--r--src/structs.h3
-rw-r--r--src/version.c2
4 files changed, 10 insertions, 4 deletions
diff --git a/src/change.c b/src/change.c
index 54ed684a6d..afc32b7241 100644
--- a/src/change.c
+++ b/src/change.c
@@ -641,7 +641,7 @@ changed_common(
set_topline(wp, wp->w_topline);
#endif
// Relative numbering may require updating more.
- if (wp->w_p_rnu)
+ if (wp->w_p_rnu && xtra != 0)
redraw_win_later(wp, SOME_VALID);
#ifdef FEAT_SYN_HL
// Cursor line highlighting probably need to be updated with
diff --git a/src/drawscreen.c b/src/drawscreen.c
index cb4757748f..9f9cb09602 100644
--- a/src/drawscreen.c
+++ b/src/drawscreen.c
@@ -2507,11 +2507,11 @@ win_update(win_T *wp)
}
else
{
- if (wp->w_p_rnu)
+ if (wp->w_p_rnu && wp->w_last_cursor_lnum_rnu != wp->w_cursor.lnum)
{
#ifdef FEAT_FOLDING
- // 'relativenumber' set: The text doesn't need to be drawn, but
- // the number column nearly always does.
+ // '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);
@@ -2553,6 +2553,7 @@ win_update(win_T *wp)
// update w_last_cursorline.
wp->w_last_cursorline = wp->w_p_cul ? wp->w_cursor.lnum : 0;
#endif
+ wp->w_last_cursor_lnum_rnu = wp->w_p_rnu ? wp->w_cursor.lnum : 0;
#ifdef FEAT_VTP
// Rewrite the character at the end of the screen line.
diff --git a/src/structs.h b/src/structs.h
index a153336c9c..192693bac4 100644
--- a/src/structs.h
+++ b/src/structs.h
@@ -3465,6 +3465,9 @@ struct window_S
colnr_T w_old_visual_col; // last known start of visual part
colnr_T w_old_curswant; // last known value of Curswant
+ linenr_T w_last_cursor_lnum_rnu; // cursor lnum when 'rnu' was last
+ // redrawn
+
lcs_chars_T w_lcs_chars; // 'listchars' characters
/*
diff --git a/src/version.c b/src/version.c
index fe7f299cbd..90b30ab321 100644
--- a/src/version.c
+++ b/src/version.c
@@ -751,6 +751,8 @@ static char *(features[]) =
static int included_patches[] =
{ /* Add new patch number below this line */
/**/
+ 4644,
+/**/
4643,
/**/
4642,