diff src/testdir/test_statusline.vim @ 31726:122cfa668b95 v9.0.1195

patch 9.0.1195: restoring KeyTyped when building statusline not tested Commit: https://github.com/vim/vim/commit/378e6c03f98efc88e8c2675e05a548f9bb7889a1 Author: zeertzjq <zeertzjq@outlook.com> Date: Sat Jan 14 11:46:49 2023 +0000 patch 9.0.1195: restoring KeyTyped when building statusline not tested Problem: Restoring KeyTyped when building statusline not tested. Solution: Add a test. Clean up and fix other tests. (closes https://github.com/vim/vim/issues/11815)
author Bram Moolenaar <Bram@vim.org>
date Sat, 14 Jan 2023 13:00:05 +0100
parents 1102f4777518
children dbec60b8c253
line wrap: on
line diff
--- a/src/testdir/test_statusline.vim
+++ b/src/testdir/test_statusline.vim
@@ -569,22 +569,41 @@ func Test_statusline_showcmd()
   CheckScreendump
 
   let lines =<< trim END
+    func MyStatusLine()
+      return '%S'
+    endfunc
+
     set laststatus=2
-    set statusline=%S
+    set statusline=%!MyStatusLine()
     set showcmdloc=statusline
     call setline(1, ['a', 'b', 'c'])
+    set foldopen+=jump
+    1,2fold
+    3
   END
   call writefile(lines, 'XTest_statusline', 'D')
 
   let buf = RunVimInTerminal('-S XTest_statusline', {'rows': 6})
-  call feedkeys("\<C-V>Gl", "xt")
+
+  call term_sendkeys(buf, "g")
   call VerifyScreenDump(buf, 'Test_statusline_showcmd_1', {})
 
-  call feedkeys("\<Esc>1234", "xt")
+  " typing "gg" should open the fold
+  call term_sendkeys(buf, "g")
   call VerifyScreenDump(buf, 'Test_statusline_showcmd_2', {})
 
-  call feedkeys("\<Esc>:set statusline=\<CR>:\<CR>1234", "xt")
+  call term_sendkeys(buf, "\<C-V>Gl")
   call VerifyScreenDump(buf, 'Test_statusline_showcmd_3', {})
+
+  call term_sendkeys(buf, "\<Esc>1234")
+  call VerifyScreenDump(buf, 'Test_statusline_showcmd_4', {})
+
+  call term_sendkeys(buf, "\<Esc>:set statusline=\<CR>")
+  call term_sendkeys(buf, ":\<CR>")
+  call term_sendkeys(buf, "1234")
+  call VerifyScreenDump(buf, 'Test_statusline_showcmd_5', {})
+
+  call StopVimInTerminal(buf)
 endfunc
 
 " vim: shiftwidth=2 sts=2 expandtab