From 1624639ec8a6c3c99e417a2990f2f02f0d0b6e10 Mon Sep 17 00:00:00 2001 From: Lewis Russell Date: Tue, 29 Mar 2022 11:38:17 +0100 Subject: patch 8.2.4644: redrawing too often when 'relativenumber' is set Problem: Redrawing too often when 'relativenumber' is set. Solution: Only redraw when the cursor line changed. (Lewis Russell, closes #10040) --- src/drawscreen.c | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) (limited to 'src/drawscreen.c') 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. -- cgit v1.2.3