Patch 9.0.0892
Problem:    May redraw when not needed, causing slow scrolling.
Solution:   Do not redraw when w_skipcol doesn't change.  When w_skipcol
            changes only redraw from the top. (issue #11559)
Files:      src/move.c, src/ex_getln.c, src/testdir/test_alot.vim,
            src/testdir/Make_all.mak


*** ../vim-9.0.0891/src/move.c  2022-10-20 20:15:40.987639315 +0100
--- src/move.c  2022-11-17 11:33:45.717786731 +0000
***************
*** 202,207 ****
--- 202,224 ----
  #endif
  
  /*
+  * Set curwin->s_skipcol to zero and redraw later if needed.
+  */
+     static void
+ reset_skipcol(void)
+ {
+     if (curwin->w_skipcol != 0)
+     {
+       curwin->w_skipcol = 0;
+ 
+       // Should use the least expensive way that displays all that changed.
+       // UPD_NOT_VALID is too expensive, UPD_REDRAW_TOP does not redraw
+       // enough when the top line gets another screen line.
+       redraw_later(UPD_SOME_VALID);
+     }
+ }
+ 
+ /*
   * Update curwin->w_topline and redraw if necessary.
   * Used to update the screen before printing a message.
   */
***************
*** 458,470 ****
            )
      {
        dollar_vcol = -1;
!       if (curwin->w_skipcol != 0)
!       {
!           curwin->w_skipcol = 0;
!           redraw_later(UPD_NOT_VALID);
!       }
!       else
!           redraw_later(UPD_VALID);
        // May need to set w_skipcol when cursor in w_topline.
        if (curwin->w_cursor.lnum == curwin->w_topline)
            validate_cursor();
--- 475,483 ----
            )
      {
        dollar_vcol = -1;
!       redraw_later(UPD_VALID);
!       reset_skipcol();
! 
        // May need to set w_skipcol when cursor in w_topline.
        if (curwin->w_cursor.lnum == curwin->w_topline)
            validate_cursor();
***************
*** 1319,1325 ****
      else if (!curwin->w_p_sms)
        curwin->w_skipcol = 0;
      if (prev_skipcol != curwin->w_skipcol)
!       redraw_later(UPD_NOT_VALID);
  
  #ifdef FEAT_SYN_HL
      redraw_for_cursorcolumn(curwin);
--- 1332,1338 ----
      else if (!curwin->w_p_sms)
        curwin->w_skipcol = 0;
      if (prev_skipcol != curwin->w_skipcol)
!       redraw_later(UPD_SOME_VALID);
  
  #ifdef FEAT_SYN_HL
      redraw_for_cursorcolumn(curwin);
***************
*** 1849,1859 ****
      if (curwin->w_cline_height == curwin->w_height)
      {
        // the line just fits in the window, don't scroll
!       if (curwin->w_skipcol != 0)
!       {
!           curwin->w_skipcol = 0;
!           redraw_later(UPD_NOT_VALID);
!       }
        return;
      }
  
--- 1862,1868 ----
      if (curwin->w_cline_height == curwin->w_height)
      {
        // the line just fits in the window, don't scroll
!       reset_skipcol();
        return;
      }
  
***************
*** 2302,2311 ****
  #endif
        // TODO: if the line doesn't fit may optimize w_skipcol
        if (curwin->w_topline == curwin->w_cursor.lnum)
!       {
!           curwin->w_skipcol = 0;
!           redraw_later(UPD_NOT_VALID);
!       }
        if (curwin->w_topline != old_topline
                || curwin->w_skipcol != old_skipcol
  #ifdef FEAT_DIFF
--- 2311,2317 ----
  #endif
        // TODO: if the line doesn't fit may optimize w_skipcol
        if (curwin->w_topline == curwin->w_cursor.lnum)
!           reset_skipcol();
        if (curwin->w_topline != old_topline
                || curwin->w_skipcol != old_skipcol
  #ifdef FEAT_DIFF
***************
*** 2737,2743 ****
        if (curwin->w_cline_height == curwin->w_height)
        {
            // The cursor line just fits in the window, don't scroll.
!           curwin->w_skipcol = 0;
            return;
        }
        // TODO: If the cursor line doesn't fit in the window then only adjust
--- 2743,2749 ----
        if (curwin->w_cline_height == curwin->w_height)
        {
            // The cursor line just fits in the window, don't scroll.
!           reset_skipcol();
            return;
        }
        // TODO: If the cursor line doesn't fit in the window then only adjust
*** ../vim-9.0.0891/src/ex_getln.c      2022-11-15 17:43:28.442135533 +0000
--- src/ex_getln.c      2022-11-17 11:30:25.878066877 +0000
***************
*** 393,398 ****
--- 393,399 ----
        magic_overruled = is_state->magic_overruled_save;
  
        validate_cursor();      // needed for TAB
+       status_redraw_all();
        redraw_all_later(UPD_SOME_VALID);
        if (call_update_screen)
            update_screen(UPD_SOME_VALID);
***************
*** 559,564 ****
--- 560,566 ----
      }
  
      validate_cursor();
+ 
      // May redraw the status line to show the cursor position.
      if (p_ru && curwin->w_status_height > 0)
        curwin->w_redr_status = TRUE;
*** ../vim-9.0.0891/src/testdir/test_alot.vim   2022-10-13 12:29:34.233533860 
+0100
--- src/testdir/test_alot.vim   2022-11-17 10:59:06.688324095 +0000
***************
*** 19,25 ****
  source test_move.vim
  source test_put.vim
  source test_reltime.vim
- source test_scroll_opt.vim
  source test_searchpos.vim
  source test_set.vim
  source test_shift.vim
--- 19,24 ----
*** ../vim-9.0.0891/src/testdir/Make_all.mak    2022-10-15 10:21:33.330116472 
+0100
--- src/testdir/Make_all.mak    2022-11-17 11:00:18.676190240 +0000
***************
*** 484,489 ****
--- 484,490 ----
        test_retab.res \
        test_ruby.res \
        test_scriptnames.res \
+       test_scroll_opt.res \
        test_scrollbind.res \
        test_search.res \
        test_search_stat.res \
*** ../vim-9.0.0891/src/version.c       2022-11-16 22:12:34.421823679 +0000
--- src/version.c       2022-11-17 10:47:43.125937612 +0000
***************
*** 697,698 ****
--- 697,700 ----
  {   /* Add new patch number below this line */
+ /**/
+     892,
  /**/

-- 
>From "know your smileys":
 :^[/   mean-smiley-with-cigarette

 /// 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/20221117113507.610C41C09F7%40moolenaar.net.

Raspunde prin e-mail lui