Patch 9.0.0652
Problem:    'smoothscroll' not tested with 'number' and "n" in 'cpo'.
Solution:   Add tests, fix uncovered problem.
Files:      src/move.c, src/drawline.c, src/drawscreen.c,
            src/testdir/test_scroll_opt.vim,
            src/testdir/dumps/Test_smooth_number_1.dump,
            src/testdir/dumps/Test_smooth_number_2.dump,
            src/testdir/dumps/Test_smooth_number_3.dump,
            src/testdir/dumps/Test_smooth_number_4.dump,
            src/testdir/dumps/Test_smooth_number_5.dump,
            src/testdir/dumps/Test_smooth_number_6.dump


*** ../vim-9.0.0651/src/move.c  2022-10-03 15:27:30.062072077 +0100
--- src/move.c  2022-10-03 18:44:35.372833434 +0100
***************
*** 50,56 ****
      {
        ++off;
        int skip = wp->w_skipcol - width;
!       width -= win_col_off2(wp);
        while (skip >= width)
        {
            ++off;
--- 50,56 ----
      {
        ++off;
        int skip = wp->w_skipcol - width;
!       width += win_col_off2(wp);
        while (skip >= width)
        {
            ++off;
*** ../vim-9.0.0651/src/drawline.c      2022-10-03 17:45:50.062276035 +0100
--- src/drawline.c      2022-10-03 19:39:12.292456216 +0100
***************
*** 347,354 ****
        int             num_attr UNUSED)
  {
      if ((wp->w_p_nu || wp->w_p_rnu)
!           && (wlv->row == wlv->startrow + wlv->filler_lines
!                        || vim_strchr(p_cpo, CPO_NUMCOL) == NULL))
      {
  #ifdef FEAT_SIGNS
        // If 'signcolumn' is set to 'number' and a sign is present
--- 347,355 ----
        int             num_attr UNUSED)
  {
      if ((wp->w_p_nu || wp->w_p_rnu)
!           && ((wlv->row == wlv->startrow + wlv->filler_lines
!                   && (wp->w_skipcol == 0 || wlv->row > wp->w_winrow))
!               || vim_strchr(p_cpo, CPO_NUMCOL) == NULL))
      {
  #ifdef FEAT_SIGNS
        // If 'signcolumn' is set to 'number' and a sign is present
*** ../vim-9.0.0651/src/drawscreen.c    2022-09-29 12:49:52.261601394 +0100
--- src/drawscreen.c    2022-10-03 19:30:51.774008595 +0100
***************
*** 1552,1557 ****
--- 1552,1577 ----
      init_search_hl(wp, &screen_search_hl);
  #endif
  
+     // Make sure skipcol is valid, it depends on various options and the 
window
+     // width.
+     if (wp->w_skipcol > 0)
+     {
+       int w = 0;
+       int width1 = wp->w_width - win_col_off(wp);
+       int width2 = width1 + win_col_off2(wp);
+       int add = width1;
+ 
+       while (w < wp->w_skipcol)
+       {
+           if (w > 0)
+               add = width2;
+           w += add;
+       }
+       if (w != wp->w_skipcol)
+           // always round down, the higher value may not be valid
+           wp->w_skipcol = w - add;
+     }
+ 
  #ifdef FEAT_LINEBREAK
      // Force redraw when width of 'number' or 'relativenumber' column
      // changes.
*** ../vim-9.0.0651/src/testdir/test_scroll_opt.vim     2022-10-03 
14:05:58.706085741 +0100
--- src/testdir/test_scroll_opt.vim     2022-10-03 19:55:42.845293799 +0100
***************
*** 106,111 ****
--- 106,146 ----
    call StopVimInTerminal(buf)
  endfunc
  
+ func Test_smoothscroll_number()
+   CheckScreendump
+ 
+   let lines =<< trim END
+       vim9script
+       setline(1, [
+         'one ' .. 'word '->repeat(20),
+         'two ' .. 'long word '->repeat(7),
+         'line',
+         'line',
+         'line',
+       ])
+       set smoothscroll
+       set number cpo+=n
+       :3
+   END
+   call writefile(lines, 'XSmoothNumber', 'D')
+   let buf = RunVimInTerminal('-S XSmoothNumber', #{rows: 12, cols: 40})
+ 
+   call VerifyScreenDump(buf, 'Test_smooth_number_1', {})
+   call term_sendkeys(buf, "\<C-E>")
+   call VerifyScreenDump(buf, 'Test_smooth_number_2', {})
+   call term_sendkeys(buf, "\<C-E>")
+   call VerifyScreenDump(buf, 'Test_smooth_number_3', {})
+ 
+   call term_sendkeys(buf, ":set cpo-=n\<CR>")
+   call VerifyScreenDump(buf, 'Test_smooth_number_4', {})
+   call term_sendkeys(buf, "\<C-Y>")
+   call VerifyScreenDump(buf, 'Test_smooth_number_5', {})
+   call term_sendkeys(buf, "\<C-Y>")
+   call VerifyScreenDump(buf, 'Test_smooth_number_6', {})
+ 
+   call StopVimInTerminal(buf)
+ endfunc
+ 
  
  
  " vim: shiftwidth=2 sts=2 expandtab
*** ../vim-9.0.0651/src/testdir/dumps/Test_smooth_number_1.dump 2022-10-03 
19:59:24.251571779 +0100
--- src/testdir/dumps/Test_smooth_number_1.dump 2022-10-03 19:55:45.761284422 
+0100
***************
*** 0 ****
--- 1,12 ----
+ | +0#af5f00255#ffffff0@1|1| |o+0#0000000&|n|e| |w|o|r|d| |w|o|r|d| |w|o|r|d| 
|w|o|r|d| |w|o|r|d| |w|o|r|d| |w|o
+ |r|d| |w|o|r|d| |w|o|r|d| |w|o|r|d| |w|o|r|d| |w|o|r|d| |w|o|r|d| |w|o|r|d| 
|w|o
+ |r|d| |w|o|r|d| |w|o|r|d| |w|o|r|d| |w|o|r|d| |w|o|r|d| @12
+ | +0#af5f00255&@1|2| |t+0#0000000&|w|o| |l|o|n|g| |w|o|r|d| |l|o|n|g| 
|w|o|r|d| |l|o|n|g| |w|o|r|d| |l|o
+ |n|g| |w|o|r|d| |l|o|n|g| |w|o|r|d| |l|o|n|g| |w|o|r|d| |l|o|n|g| |w|o|r|d| @2
+ | +0#af5f00255&@1|3| >l+0#0000000&|i|n|e| @31
+ | +0#af5f00255&@1|4| |l+0#0000000&|i|n|e| @31
+ | +0#af5f00255&@1|5| |l+0#0000000&|i|n|e| @31
+ |~+0#4040ff13&| @38
+ |~| @38
+ |~| @38
+ | +0#0000000&@21|3|,|1| @10|A|l@1| 
*** ../vim-9.0.0651/src/testdir/dumps/Test_smooth_number_2.dump 2022-10-03 
19:59:24.255571818 +0100
--- src/testdir/dumps/Test_smooth_number_2.dump 2022-10-03 19:55:46.909280735 
+0100
***************
*** 0 ****
--- 1,12 ----
+ |<+0#4040ff13#ffffff0@2|w+0#0000000&|o|r|d| |w|o|r|d| |w|o|r|d| |w|o|r|d| 
|w|o|r|d| |w|o|r|d| |w|o|r|d| |w|o
+ |r|d| |w|o|r|d| |w|o|r|d| |w|o|r|d| |w|o|r|d| |w|o|r|d| @12
+ | +0#af5f00255&@1|2| |t+0#0000000&|w|o| |l|o|n|g| |w|o|r|d| |l|o|n|g| 
|w|o|r|d| |l|o|n|g| |w|o|r|d| |l|o
+ |n|g| |w|o|r|d| |l|o|n|g| |w|o|r|d| |l|o|n|g| |w|o|r|d| |l|o|n|g| |w|o|r|d| @2
+ | +0#af5f00255&@1|3| >l+0#0000000&|i|n|e| @31
+ | +0#af5f00255&@1|4| |l+0#0000000&|i|n|e| @31
+ | +0#af5f00255&@1|5| |l+0#0000000&|i|n|e| @31
+ |~+0#4040ff13&| @38
+ |~| @38
+ |~| @38
+ |~| @38
+ | +0#0000000&@21|3|,|1| @10|A|l@1| 
*** ../vim-9.0.0651/src/testdir/dumps/Test_smooth_number_3.dump 2022-10-03 
19:59:24.259571854 +0100
--- src/testdir/dumps/Test_smooth_number_3.dump 2022-10-03 19:55:48.057277045 
+0100
***************
*** 0 ****
--- 1,12 ----
+ |<+0#4040ff13#ffffff0@2|w+0#0000000&|o|r|d| |w|o|r|d| |w|o|r|d| |w|o|r|d| 
|w|o|r|d| @12
+ | +0#af5f00255&@1|2| |t+0#0000000&|w|o| |l|o|n|g| |w|o|r|d| |l|o|n|g| 
|w|o|r|d| |l|o|n|g| |w|o|r|d| |l|o
+ |n|g| |w|o|r|d| |l|o|n|g| |w|o|r|d| |l|o|n|g| |w|o|r|d| |l|o|n|g| |w|o|r|d| @2
+ | +0#af5f00255&@1|3| >l+0#0000000&|i|n|e| @31
+ | +0#af5f00255&@1|4| |l+0#0000000&|i|n|e| @31
+ | +0#af5f00255&@1|5| |l+0#0000000&|i|n|e| @31
+ |~+0#4040ff13&| @38
+ |~| @38
+ |~| @38
+ |~| @38
+ |~| @38
+ | +0#0000000&@21|3|,|1| @10|A|l@1| 
*** ../vim-9.0.0651/src/testdir/dumps/Test_smooth_number_4.dump 2022-10-03 
19:59:24.263571893 +0100
--- src/testdir/dumps/Test_smooth_number_4.dump 2022-10-03 19:55:49.209273341 
+0100
***************
*** 0 ****
--- 1,12 ----
+ |<+0#4040ff13#ffffff0@2| +0#af5f00255&|d+0#0000000&| |w|o|r|d| |w|o|r|d| 
|w|o|r|d| |w|o|r|d| |w|o|r|d| |w|o|r|d| @4
+ | +0#af5f00255&@1|2| |t+0#0000000&|w|o| |l|o|n|g| |w|o|r|d| |l|o|n|g| 
|w|o|r|d| |l|o|n|g| |w|o|r|d| |l|o
+ | +0#af5f00255&@3|n+0#0000000&|g| |w|o|r|d| |l|o|n|g| |w|o|r|d| |l|o|n|g| 
|w|o|r|d| |l|o|n|g| |w|o|r
+ | +0#af5f00255&@3|d+0#0000000&| @34
+ | +0#af5f00255&@1|3| >l+0#0000000&|i|n|e| @31
+ | +0#af5f00255&@1|4| |l+0#0000000&|i|n|e| @31
+ | +0#af5f00255&@1|5| |l+0#0000000&|i|n|e| @31
+ |~+0#4040ff13&| @38
+ |~| @38
+ |~| @38
+ |~| @38
+ |:+0#0000000&|s|e|t| |c|p|o|-|=|n| @10|3|,|1| @10|A|l@1| 
*** ../vim-9.0.0651/src/testdir/dumps/Test_smooth_number_5.dump 2022-10-03 
19:59:24.267571932 +0100
--- src/testdir/dumps/Test_smooth_number_5.dump 2022-10-03 19:55:50.357269650 
+0100
***************
*** 0 ****
--- 1,12 ----
+ |<+0#4040ff13#ffffff0@2| +0#af5f00255&|r+0#0000000&|d| |w|o|r|d| |w|o|r|d| 
|w|o|r|d| |w|o|r|d| |w|o|r|d| |w|o|r|d| |w|o|r
+ | +0#af5f00255&@3|d+0#0000000&| |w|o|r|d| |w|o|r|d| |w|o|r|d| |w|o|r|d| 
|w|o|r|d| |w|o|r|d| @4
+ | +0#af5f00255&@1|2| |t+0#0000000&|w|o| |l|o|n|g| |w|o|r|d| |l|o|n|g| 
|w|o|r|d| |l|o|n|g| |w|o|r|d| |l|o
+ | +0#af5f00255&@3|n+0#0000000&|g| |w|o|r|d| |l|o|n|g| |w|o|r|d| |l|o|n|g| 
|w|o|r|d| |l|o|n|g| |w|o|r
+ | +0#af5f00255&@3|d+0#0000000&| @34
+ | +0#af5f00255&@1|3| >l+0#0000000&|i|n|e| @31
+ | +0#af5f00255&@1|4| |l+0#0000000&|i|n|e| @31
+ | +0#af5f00255&@1|5| |l+0#0000000&|i|n|e| @31
+ |~+0#4040ff13&| @38
+ |~| @38
+ |~| @38
+ |:+0#0000000&|s|e|t| |c|p|o|-|=|n| @10|3|,|1| @10|A|l@1| 
*** ../vim-9.0.0651/src/testdir/dumps/Test_smooth_number_6.dump 2022-10-03 
19:59:24.271571971 +0100
--- src/testdir/dumps/Test_smooth_number_6.dump 2022-10-03 19:55:51.509265948 
+0100
***************
*** 0 ****
--- 1,12 ----
+ | +0#af5f00255#ffffff0@1|1| |o+0#0000000&|n|e| |w|o|r|d| |w|o|r|d| |w|o|r|d| 
|w|o|r|d| |w|o|r|d| |w|o|r|d| |w|o
+ | +0#af5f00255&@3|r+0#0000000&|d| |w|o|r|d| |w|o|r|d| |w|o|r|d| |w|o|r|d| 
|w|o|r|d| |w|o|r|d| |w|o|r
+ | +0#af5f00255&@3|d+0#0000000&| |w|o|r|d| |w|o|r|d| |w|o|r|d| |w|o|r|d| 
|w|o|r|d| |w|o|r|d| @4
+ | +0#af5f00255&@1|2| |t+0#0000000&|w|o| |l|o|n|g| |w|o|r|d| |l|o|n|g| 
|w|o|r|d| |l|o|n|g| |w|o|r|d| |l|o
+ | +0#af5f00255&@3|n+0#0000000&|g| |w|o|r|d| |l|o|n|g| |w|o|r|d| |l|o|n|g| 
|w|o|r|d| |l|o|n|g| |w|o|r
+ | +0#af5f00255&@3|d+0#0000000&| @34
+ | +0#af5f00255&@1|3| >l+0#0000000&|i|n|e| @31
+ | +0#af5f00255&@1|4| |l+0#0000000&|i|n|e| @31
+ | +0#af5f00255&@1|5| |l+0#0000000&|i|n|e| @31
+ |~+0#4040ff13&| @38
+ |~| @38
+ |:+0#0000000&|s|e|t| |c|p|o|-|=|n| @10|3|,|1| @10|A|l@1| 
*** ../vim-9.0.0651/src/version.c       2022-10-03 17:45:50.066276031 +0100
--- src/version.c       2022-10-03 19:58:56.371294784 +0100
***************
*** 701,702 ****
--- 701,704 ----
  {   /* Add new patch number below this line */
+ /**/
+     652,
  /**/

-- 
hundred-and-one symptoms of being an internet addict:
266. You hear most of your jokes via e-mail instead of in person.

 /// 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/20221003190235.3C4091C09A3%40moolenaar.net.

Raspunde prin e-mail lui