Patch 9.0.1513
Problem:    Text scrolls unnecessarily when splitting and 'splitkeep' is not
            "cursor".
Solution:   Avoid resetting w_skipcol. (Luuk van Baal, closes #12334)
Files:      src/window.c, src/testdir/test_window_cmd.vim,
            src/testdir/dumps/Test_splitkeep_skipcol_1.dump


*** ../vim-9.0.1512/src/window.c        2023-04-26 19:01:39.879978980 +0100
--- src/window.c        2023-05-06 12:49:27.343641006 +0100
***************
*** 1453,1458 ****
--- 1453,1460 ----
  
      if (*p_spk != 'c')
      {
+       if (*p_spk == 't')
+           newp->w_skipcol = oldp->w_skipcol;
        newp->w_botline = oldp->w_botline;
        newp->w_prev_height = oldp->w_height - WINBAR_HEIGHT(oldp);
        newp->w_prev_winrow = oldp->w_winrow + 2 * WINBAR_HEIGHT(oldp);
***************
*** 6860,6873 ****
      }
  
      wp->w_height = height;
-     wp->w_skipcol = 0;
      wp->w_redr_status = TRUE;
      win_comp_scroll(wp);
  
      // There is no point in adjusting the scroll position when exiting.  Some
      // values might be invalid.
      if (!exiting && *p_spk == 'c')
        scroll_to_fraction(wp, prev_height);
  }
  
      void
--- 6862,6877 ----
      }
  
      wp->w_height = height;
      wp->w_redr_status = TRUE;
      win_comp_scroll(wp);
  
      // There is no point in adjusting the scroll position when exiting.  Some
      // values might be invalid.
      if (!exiting && *p_spk == 'c')
+     {
+       wp->w_skipcol = 0;
        scroll_to_fraction(wp, prev_height);
+     }
  }
  
      void
*** ../vim-9.0.1512/src/testdir/test_window_cmd.vim     2023-04-26 
19:01:39.883978985 +0100
--- src/testdir/test_window_cmd.vim     2023-05-06 12:49:27.339641010 +0100
***************
*** 1935,1940 ****
--- 1935,1957 ----
    call StopVimInTerminal(buf)
  endfunc
  
+ " skipcol is not reset unnecessarily and is copied to new window
+ func Test_splitkeep_skipcol()
+   CheckScreendump
+ 
+   let lines =<< trim END
+     set splitkeep=topline smoothscroll splitbelow scrolloff=0
+     call setline(1, 'with lots of text in one line '->repeat(6))
+     norm 2 
+     wincmd s
+   END
+ 
+   call writefile(lines, 'XTestSplitkeepSkipcol', 'D')
+   let buf = RunVimInTerminal('-S XTestSplitkeepSkipcol', #{rows: 12, cols: 
40})
+ 
+   call VerifyScreenDump(buf, 'Test_splitkeep_skipcol_1', {})
+ endfunc
+ 
  func Test_new_help_window_on_error()
    help change.txt
    execute "normal! /CTRL-@\<CR>"
*** ../vim-9.0.1512/src/testdir/dumps/Test_splitkeep_skipcol_1.dump     
2023-05-06 12:53:24.135354728 +0100
--- src/testdir/dumps/Test_splitkeep_skipcol_1.dump     2023-05-06 
12:49:27.339641010 +0100
***************
*** 0 ****
--- 1,12 ----
+ |<+0#4040ff13#ffffff0@2|e+0#0000000&| |l|i|n|e| |w|i|t|h| |l|o|t|s| |o|f| 
|t|e|x|t| |i|n| |o|n|e| |l|i|n|e| 
+ |w|i|t|h| |l|o|t|s| |o|f| |t|e|x|t| |i|n| |o|n|e| |l|i|n|e| |w|i|t|h| 
|l|o|t|s| 
+ |o|f| |t|e|x|t| |i|n| |o|n|e| |l|i|n|e| @20
+ |~+0#4040ff13&| @38
+ |[+1#0000000&|N|o| |N|a|m|e|]| |[|+|]| @8|1|,|1|2|1| @9|A|l@1
+ |<+0#4040ff13&@2|e+0#0000000&| |l|i|n|e| |w|i|t|h| |l|o|t|s| |o|f| |t|e|x|t| 
|i|n| |o|n|e| |l|i|n|e| 
+ >w|i|t|h| |l|o|t|s| |o|f| |t|e|x|t| |i|n| |o|n|e| |l|i|n|e| |w|i|t|h| 
|l|o|t|s| 
+ |o|f| |t|e|x|t| |i|n| |o|n|e| |l|i|n|e| @20
+ |~+0#4040ff13&| @38
+ |~| @38
+ |[+3#0000000&|N|o| |N|a|m|e|]| |[|+|]| @8|1|,|1|2|1| @9|A|l@1
+ | +0&&@39
*** ../vim-9.0.1512/src/version.c       2023-05-06 12:39:58.736971487 +0100
--- src/version.c       2023-05-06 12:51:35.663474091 +0100
***************
*** 697,698 ****
--- 697,700 ----
  {   /* Add new patch number below this line */
+ /**/
+     1513,
  /**/

-- 
An operatingsystem is just a name you give to the rest of bloating
idiosyncratic machine-based-features you left out of your editor.
                        (author unknown)

 /// Bram Moolenaar -- b...@moolenaar.net -- 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 vim_dev+unsubscr...@googlegroups.com.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/vim_dev/20230506115419.B46131C1B21%40moolenaar.net.

Reply via email to