Patch 8.2.4644
Problem:    Redrawing too often when 'relativenumber' is set.
Solution:   Only redraw when the cursor line changed. (Lewis Russell,
            closes #10040)
Files:      src/change.c, src/drawscreen.c, src/structs.h


*** ../vim-8.2.4643/src/change.c        2022-02-16 21:50:53.966082550 +0000
--- src/change.c        2022-03-29 11:30:36.911350458 +0100
***************
*** 641,647 ****
                set_topline(wp, wp->w_topline);
  #endif
            // Relative numbering may require updating more.
!           if (wp->w_p_rnu)
                redraw_win_later(wp, SOME_VALID);
  #ifdef FEAT_SYN_HL
            // Cursor line highlighting probably need to be updated with
--- 641,647 ----
                set_topline(wp, wp->w_topline);
  #endif
            // Relative numbering may require updating more.
!           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
*** ../vim-8.2.4643/src/drawscreen.c    2022-03-27 19:26:29.330889018 +0100
--- src/drawscreen.c    2022-03-29 11:34:43.743228669 +0100
***************
*** 2507,2517 ****
        }
        else
        {
!           if (wp->w_p_rnu)
            {
  #ifdef FEAT_FOLDING
!               // 'relativenumber' set: The text doesn't need to be drawn, but
!               // the number column nearly always does.
                fold_count = foldedCount(wp, lnum, &win_foldinfo);
                if (fold_count != 0)
                    fold_line(wp, fold_count, &win_foldinfo, lnum, row);
--- 2507,2517 ----
        }
        else
        {
!           if (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);
***************
*** 2553,2558 ****
--- 2553,2559 ----
      // 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.
*** ../vim-8.2.4643/src/structs.h       2022-03-27 20:04:16.029188564 +0100
--- src/structs.h       2022-03-29 11:34:08.891250735 +0100
***************
*** 3465,3470 ****
--- 3465,3473 ----
      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
  
      /*
*** ../vim-8.2.4643/src/version.c       2022-03-28 18:16:43.619673423 +0100
--- src/version.c       2022-03-29 11:32:07.455315837 +0100
***************
*** 752,753 ****
--- 752,755 ----
  {   /* Add new patch number below this line */
+ /**/
+     4644,
  /**/

-- 
FATHER:    You only killed the bride's father - that's all -
LAUNCELOT: Oh dear, I didn't really mean to...
FATHER:    Didn't mean to?  You put your sword right through his head!
LAUNCELOT: Gosh - Is he all right?
                 "Monty Python and the Holy Grail" PYTHON (MONTY) PICTURES LTD

 /// Bram Moolenaar -- [email protected] -- http://www.Moolenaar.net   \\\
///                                                                      \\\
\\\        sponsor Vim, vote for features -- http://www.Vim.org/sponsor/ ///
 \\\            help me help AIDS victims -- http://ICCF-Holland.org    ///

-- 
-- 
You received this message from the "vim_dev" maillist.
Do not top-post! Type your reply below the text you are replying to.
For more information, visit http://www.vim.org/maillist.php

--- 
You received this message because you are subscribed to the Google Groups 
"vim_dev" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to [email protected].
To view this discussion on the web visit 
https://groups.google.com/d/msgid/vim_dev/20220329103845.B76991C0C1F%40moolenaar.net.

Raspunde prin e-mail lui