Patch 9.0.0672
Problem:    Cursor line only partly shows with 'smoothscroll' and 'scrolloff'
            zero.
Solution:   Do not use 'smoothscroll' when adjusting the bottom of the window.
            (closes #11269)
Files:      src/move.c, src/testdir/test_scroll_opt.vim,
            src/testdir/dumps/Test_smooth_wrap_1.dump,
            src/testdir/dumps/Test_smooth_wrap_2.dump,
            src/testdir/dumps/Test_smooth_wrap_3.dump,
            src/testdir/dumps/Test_smooth_wrap_4.dump


*** ../vim-9.0.0671/src/move.c  2022-10-06 13:08:58.626974128 +0100
--- src/move.c  2022-10-06 14:56:15.091515299 +0100
***************
*** 2171,2176 ****
--- 2171,2177 ----
  {
      int               used;
      int               scrolled = 0;
+     int               min_scrolled = 1;
      int               extra = 0;
      int               i;
      linenr_T  line_count;
***************
*** 2236,2241 ****
--- 2237,2246 ----
        scrolled = used;
        if (cln == curwin->w_botline)
            scrolled -= curwin->w_empty_rows;
+       min_scrolled = scrolled;
+       if (cln > curwin->w_botline && curwin->w_p_sms && curwin->w_p_wrap)
+           for (linenr_T lnum = curwin->w_botline + 1; lnum <= cln; ++lnum)
+               min_scrolled += plines_nofill(lnum);
      }
  
      /*
***************
*** 2361,2367 ****
--- 2366,2377 ----
      if (line_count >= curwin->w_height && line_count > min_scroll)
        scroll_cursor_halfway(FALSE);
      else
+     {
+       // With 'smoothscroll' scroll at least the height of the cursor line.
+       if (curwin->w_p_wrap && curwin->w_p_sms && line_count < min_scrolled)
+           line_count = min_scrolled;
        scrollup(line_count, TRUE);
+     }
  
      /*
       * If topline didn't change we need to restore w_botline and w_empty_rows
*** ../vim-9.0.0671/src/testdir/test_scroll_opt.vim     2022-10-06 
13:08:58.626974128 +0100
--- src/testdir/test_scroll_opt.vim     2022-10-06 14:53:27.587922845 +0100
***************
*** 167,172 ****
--- 167,197 ----
    call StopVimInTerminal(buf)
  endfunc
  
+ func Test_smoothscroll_wrap_scrolloff_zero()
+   CheckScreendump
+ 
+   let lines =<< trim END
+       vim9script
+       setline(1, ['Line' .. (' with some text'->repeat(7))]->repeat(7))
+       set smoothscroll scrolloff=0
+       :3
+   END
+   call writefile(lines, 'XSmoothWrap', 'D')
+   let buf = RunVimInTerminal('-S XSmoothWrap', #{rows: 8, cols: 40})
+ 
+   call VerifyScreenDump(buf, 'Test_smooth_wrap_1', {})
+ 
+   call term_sendkeys(buf, "j")
+   call VerifyScreenDump(buf, 'Test_smooth_wrap_2', {})
+ 
+   call term_sendkeys(buf, "\<C-E>j")
+   call VerifyScreenDump(buf, 'Test_smooth_wrap_3', {})
+ 
+   call term_sendkeys(buf, "G")
+   call VerifyScreenDump(buf, 'Test_smooth_wrap_4', {})
+ 
+   call StopVimInTerminal(buf)
+ endfunc
  
  
  " vim: shiftwidth=2 sts=2 expandtab
*** ../vim-9.0.0671/src/testdir/dumps/Test_smooth_wrap_1.dump   2022-10-06 
14:56:48.867434892 +0100
--- src/testdir/dumps/Test_smooth_wrap_1.dump   2022-10-06 14:53:30.995914389 
+0100
***************
*** 0 ****
--- 1,8 ----
+ |<+0#4040ff13#ffffff0@2|h+0#0000000&| |s|o|m|e| |t|e|x|t| |w|i|t|h| |s|o|m|e| 
|t|e|x|t| @10
+ |L|i|n|e| |w|i|t|h| |s|o|m|e| |t|e|x|t| |w|i|t|h| |s|o|m|e| |t|e|x|t| 
|w|i|t|h| 
+ |s|o|m|e| |t|e|x|t| |w|i|t|h| |s|o|m|e| |t|e|x|t| |w|i|t|h| |s|o|m|e| 
|t|e|x|t| 
+ |w|i|t|h| |s|o|m|e| |t|e|x|t| |w|i|t|h| |s|o|m|e| |t|e|x|t| @10
+ >L|i|n|e| |w|i|t|h| |s|o|m|e| |t|e|x|t| |w|i|t|h| |s|o|m|e| |t|e|x|t| 
|w|i|t|h| 
+ |s|o|m|e| |t|e|x|t| |w|i|t|h| |s|o|m|e| |t|e|x|t| |w|i|t|h| |s|o|m|e| 
|t|e|x|t| 
+ |w|i|t|h| |s|o|m|e| |t|e|x|t| |w|i|t|h| |s|o|m|e| |t|e|x|t| @10
+ @22|3|,|1| @10|T|o|p| 
*** ../vim-9.0.0671/src/testdir/dumps/Test_smooth_wrap_2.dump   2022-10-06 
14:56:48.871434884 +0100
--- src/testdir/dumps/Test_smooth_wrap_2.dump   2022-10-06 14:53:32.147911532 
+0100
***************
*** 0 ****
--- 1,8 ----
+ |<+0#4040ff13#ffffff0@2|h+0#0000000&| |s|o|m|e| |t|e|x|t| |w|i|t|h| |s|o|m|e| 
|t|e|x|t| @10
+ |L|i|n|e| |w|i|t|h| |s|o|m|e| |t|e|x|t| |w|i|t|h| |s|o|m|e| |t|e|x|t| 
|w|i|t|h| 
+ |s|o|m|e| |t|e|x|t| |w|i|t|h| |s|o|m|e| |t|e|x|t| |w|i|t|h| |s|o|m|e| 
|t|e|x|t| 
+ |w|i|t|h| |s|o|m|e| |t|e|x|t| |w|i|t|h| |s|o|m|e| |t|e|x|t| @10
+ >L|i|n|e| |w|i|t|h| |s|o|m|e| |t|e|x|t| |w|i|t|h| |s|o|m|e| |t|e|x|t| 
|w|i|t|h| 
+ |s|o|m|e| |t|e|x|t| |w|i|t|h| |s|o|m|e| |t|e|x|t| |w|i|t|h| |s|o|m|e| 
|t|e|x|t| 
+ |w|i|t|h| |s|o|m|e| |t|e|x|t| |w|i|t|h| |s|o|m|e| |t|e|x|t| @10
+ @22|4|,|1| @10|2|5|%| 
*** ../vim-9.0.0671/src/testdir/dumps/Test_smooth_wrap_3.dump   2022-10-06 
14:56:48.875434872 +0100
--- src/testdir/dumps/Test_smooth_wrap_3.dump   2022-10-06 14:53:33.299908672 
+0100
***************
*** 0 ****
--- 1,8 ----
+ |<+0#4040ff13#ffffff0@2|h+0#0000000&| |s|o|m|e| |t|e|x|t| |w|i|t|h| |s|o|m|e| 
|t|e|x|t| @10
+ |L|i|n|e| |w|i|t|h| |s|o|m|e| |t|e|x|t| |w|i|t|h| |s|o|m|e| |t|e|x|t| 
|w|i|t|h| 
+ |s|o|m|e| |t|e|x|t| |w|i|t|h| |s|o|m|e| |t|e|x|t| |w|i|t|h| |s|o|m|e| 
|t|e|x|t| 
+ |w|i|t|h| |s|o|m|e| |t|e|x|t| |w|i|t|h| |s|o|m|e| |t|e|x|t| @10
+ >L|i|n|e| |w|i|t|h| |s|o|m|e| |t|e|x|t| |w|i|t|h| |s|o|m|e| |t|e|x|t| 
|w|i|t|h| 
+ |s|o|m|e| |t|e|x|t| |w|i|t|h| |s|o|m|e| |t|e|x|t| |w|i|t|h| |s|o|m|e| 
|t|e|x|t| 
+ |w|i|t|h| |s|o|m|e| |t|e|x|t| |w|i|t|h| |s|o|m|e| |t|e|x|t| @10
+ @22|5|,|1| @10|5|0|%| 
*** ../vim-9.0.0671/src/testdir/dumps/Test_smooth_wrap_4.dump   2022-10-06 
14:56:48.879434863 +0100
--- src/testdir/dumps/Test_smooth_wrap_4.dump   2022-10-06 14:53:34.451905814 
+0100
***************
*** 0 ****
--- 1,8 ----
+ |<+0#4040ff13#ffffff0@2|h+0#0000000&| |s|o|m|e| |t|e|x|t| |w|i|t|h| |s|o|m|e| 
|t|e|x|t| @10
+ |L|i|n|e| |w|i|t|h| |s|o|m|e| |t|e|x|t| |w|i|t|h| |s|o|m|e| |t|e|x|t| 
|w|i|t|h| 
+ |s|o|m|e| |t|e|x|t| |w|i|t|h| |s|o|m|e| |t|e|x|t| |w|i|t|h| |s|o|m|e| 
|t|e|x|t| 
+ |w|i|t|h| |s|o|m|e| |t|e|x|t| |w|i|t|h| |s|o|m|e| |t|e|x|t| @10
+ >L|i|n|e| |w|i|t|h| |s|o|m|e| |t|e|x|t| |w|i|t|h| |s|o|m|e| |t|e|x|t| 
|w|i|t|h| 
+ |s|o|m|e| |t|e|x|t| |w|i|t|h| |s|o|m|e| |t|e|x|t| |w|i|t|h| |s|o|m|e| 
|t|e|x|t| 
+ |w|i|t|h| |s|o|m|e| |t|e|x|t| |w|i|t|h| |s|o|m|e| |t|e|x|t| @10
+ @22|7|,|1| @10|B|o|t| 
*** ../vim-9.0.0671/src/version.c       2022-10-06 13:08:58.626974128 +0100
--- src/version.c       2022-10-06 14:56:34.731468478 +0100
***************
*** 701,702 ****
--- 701,704 ----
  {   /* Add new patch number below this line */
+ /**/
+     672,
  /**/

-- 
Microsoft's definition of a boolean: TRUE, FALSE, MAYBE
"Embrace and extend"...?

 /// 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/20221006140237.CBF441C0C31%40moolenaar.net.

Raspunde prin e-mail lui