diff src/testdir/test_functions.vim @ 33842:68de519bab0a v9.0.2133

patch 9.0.2133: Cannot detect overstrike mode in Cmdline mode Commit: https://github.com/vim/vim/commit/d1c3ef1f47c87d1da056c56564e1985fe6f2931d Author: Sam-programs <None> Date: Mon Nov 27 22:22:51 2023 +0100 patch 9.0.2133: Cannot detect overstrike mode in Cmdline mode Problem: Cannot detect overstrike mode in Cmdline mode Solution: Make mode() return "cr" for overstrike closes: #13569 Signed-off-by: Sam-programs <None> Signed-off-by: Christian Brabandt <cb@256bit.org>
author Christian Brabandt <cb@256bit.org>
date Mon, 27 Nov 2023 22:30:07 +0100
parents 08f9e1eac4cf
children c3804ff17204
line wrap: on
line diff
--- a/src/testdir/test_functions.vim
+++ b/src/testdir/test_functions.vim
@@ -916,8 +916,12 @@ func Test_mode()
 
   call feedkeys(":echo \<C-R>=Save_mode()\<C-U>\<CR>", 'xt')
   call assert_equal('c-c', g:current_modes)
+  call feedkeys(":\<insert>\<C-r>=Save_mode()\<CR>",'xt')
+  call assert_equal("c-cr", g:current_modes)
   call feedkeys("gQecho \<C-R>=Save_mode()\<CR>\<CR>vi\<CR>", 'xt')
   call assert_equal('c-cv', g:current_modes)
+  call feedkeys("gQ\<insert>\<C-r>=Save_mode()\<CR>",'xt')
+  call assert_equal("c-cvr", g:current_modes)
   call feedkeys("Qcall Save_mode()\<CR>vi\<CR>", 'xt')
   call assert_equal('c-ce', g:current_modes)
   " How to test Ex mode?
@@ -935,6 +939,18 @@ func Test_mode()
   call assert_equal('n-niR', g:current_modes)
   execute "normal! gR\<C-o>g@l\<Esc>"
   call assert_equal('n-niV', g:current_modes)
+  " Test statusline updates for overstike mode
+  if CanRunVimInTerminal()
+    let buf = RunVimInTerminal('', {'rows': 12})
+    call term_sendkeys(buf, ":set laststatus=2 statusline=%!mode(1)\<CR>")
+    call term_sendkeys(buf, ":")
+    call TermWait(buf)
+    call VerifyScreenDump(buf, 'Test_mode_1', {})
+    call term_sendkeys(buf, "\<insert>")
+    call TermWait(buf)
+    call VerifyScreenDump(buf, 'Test_mode_2', {})
+    call StopVimInTerminal(buf)
+  endif
 
   if has('terminal')
     term