diff src/testdir/test_window_cmd.vim @ 30439:e3091fc473a1 v9.0.0555

patch 9.0.0555: scrolling with 'nosplitscroll' in callback changing curwin Commit: https://github.com/vim/vim/commit/20e58561abc4116f3bfbafaef242d886dd77b303 Author: Luuk van Baal <luukvbaal@gmail.com> Date: Fri Sep 23 12:57:09 2022 +0100 patch 9.0.0555: scrolling with 'nosplitscroll' in callback changing curwin Problem: Scrolling with 'nosplitscroll' in callback changing curwin. Solution: Invalidate w_cline_row in the right place. (Luuk van Baal, closes #11185)
author Bram Moolenaar <Bram@vim.org>
date Fri, 23 Sep 2022 14:00:06 +0200
parents b5f67135fcb6
children 04df44c52d65
line wrap: on
line diff
--- a/src/testdir/test_window_cmd.vim
+++ b/src/testdir/test_window_cmd.vim
@@ -1,6 +1,7 @@
 " Tests for window cmd (:wincmd, :split, :vsplit, :resize and etc...)
 
 source check.vim
+source screendump.vim
 
 func Test_window_cmd_ls0_with_split()
   set ls=0
@@ -1817,4 +1818,34 @@ function Test_nosplitscroll_misc()
   set splitscroll&
 endfunc
 
+function Test_nosplitscroll_callback()
+  CheckScreendump
+  let lines =<< trim END
+    set nosplitscroll
+    call setline(1, range(&lines))
+    function WincmdCb(a, b)
+      split | wincmd p
+    endfunction
+    function TermCb(a, b)
+      close | split
+    endfunction
+    nnoremap t <cmd>call popup_create(term_start(&shell, { 'hidden': 1, 'exit_cb': 'TermCb' }), {})<CR>
+    nnoremap j <cmd>call job_start([&shell, &shellcmdflag, "echo"], { 'exit_cb': 'WincmdCb' })<CR>
+  END
+  call writefile(lines, 'XTestNosplitscrollCallback', 'D')
+  let buf = RunVimInTerminal('-S XTestNosplitscrollCallback', #{rows: 8})
+
+  call term_sendkeys(buf, "j")
+  call VerifyScreenDump(buf, 'Test_nosplitscroll_callback_1', {})
+
+  call term_sendkeys(buf, ":quit\<CR>Htexit\<CR>")
+  call VerifyScreenDump(buf, 'Test_nosplitscroll_callback_2', {})
+
+  call term_sendkeys(buf, ":set sb\<CR>:quit\<CR>Gj")
+  call VerifyScreenDump(buf, 'Test_nosplitscroll_callback_3', {})
+
+  call term_sendkeys(buf, ":quit\<CR>Gtexit\<CR>")
+  call VerifyScreenDump(buf, 'Test_nosplitscroll_callback_4', {})
+endfunc
+
 " vim: shiftwidth=2 sts=2 expandtab