Patch 9.0.0645
Problem:    CTRL-Y does not stop at line 1. (John Marriott)
Solution:   Stop at line 1 when 'smoothscroll' is not set. (closes #11261)
Files:      src/move.c, src/testdir/test_scroll_opt.vim


*** ../vim-9.0.0644/src/move.c  2022-10-02 21:29:18.416089542 +0100
--- src/move.c  2022-10-03 12:10:37.470483660 +0100
***************
*** 1485,1495 ****
        else
  #endif
        {
!           if (curwin->w_topline == 1 && curwin->w_skipcol < width1)
                break;
            if (curwin->w_p_wrap && curwin->w_p_sms
!                                                 && curwin->w_skipcol >= 
width1)
            {
                if (curwin->w_skipcol >= width1 + width2)
                    curwin->w_skipcol -= width2;
                else
--- 1485,1498 ----
        else
  #endif
        {
!           // break when at the very top
!           if (curwin->w_topline == 1
!                          && (!curwin->w_p_sms || curwin->w_skipcol < width1))
                break;
            if (curwin->w_p_wrap && curwin->w_p_sms
!                                               && curwin->w_skipcol >= width1)
            {
+               // scroll a screen line down
                if (curwin->w_skipcol >= width1 + width2)
                    curwin->w_skipcol -= width2;
                else
***************
*** 1499,1504 ****
--- 1502,1508 ----
            }
            else
            {
+               // scroll a text line down
                --curwin->w_topline;
                curwin->w_skipcol = 0;
  #ifdef FEAT_DIFF
*** ../vim-9.0.0644/src/testdir/test_scroll_opt.vim     2022-10-02 
21:29:18.416089542 +0100
--- src/testdir/test_scroll_opt.vim     2022-10-03 12:09:32.970706910 +0100
***************
*** 37,42 ****
--- 37,55 ----
    quit!
  endfunc
  
+ func Test_CtrlE_CtrlY_stop_at_end()
+   enew
+   call setline(1, ['one', 'two'])
+   set number
+   exe "normal \<C-Y>"
+   call assert_equal(["  1 one   "], ScreenLines(1, 10))
+   exe "normal \<C-E>\<C-E>\<C-E>"
+   call assert_equal(["  2 two   "], ScreenLines(1, 10))
+ 
+   bwipe!
+   set nonumber
+ endfunc
+ 
  func Test_smoothscroll_CtrlE_CtrlY()
    CheckScreendump
  
*** ../vim-9.0.0644/src/version.c       2022-10-03 11:22:59.217008645 +0100
--- src/version.c       2022-10-03 12:05:07.347799919 +0100
***************
*** 701,702 ****
--- 701,704 ----
  {   /* Add new patch number below this line */
+ /**/
+     645,
  /**/

-- 
Did you hear about the new 3 million dollar West Virginia State Lottery?
The winner gets 3 dollars a year for a million years.

 /// 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/20221003111438.9CF731C0E9E%40moolenaar.net.

Raspunde prin e-mail lui