diff src/testdir/test_edit.vim @ 32194:baafb135b0cb v9.0.1428

patch 9.0.1428: cursor in wrong position when leaving insert mode Commit: https://github.com/vim/vim/commit/c174c2e58c9e24a75b189e01143e6d057b84e96e Author: Bram Moolenaar <Bram@vim.org> Date: Sat Mar 25 20:06:49 2023 +0000 patch 9.0.1428: cursor in wrong position when leaving insert mode Problem: Cursor in wrong position when leaving insert mode. Solution: Update the w_valid flags. Position the cursor also when not redrawing. (closes #12137)
author Bram Moolenaar <Bram@vim.org>
date Sat, 25 Mar 2023 21:15:05 +0100
parents 717a1a8dc751
children def9fc5c92d1
line wrap: on
line diff
--- a/src/testdir/test_edit.vim
+++ b/src/testdir/test_edit.vim
@@ -5,6 +5,7 @@ if exists("+t_kD")
 endif
 
 source check.vim
+source screendump.vim
 
 " Needed for testing basic rightleft: Test_edit_rightleft
 source view_util.vim
@@ -1957,6 +1958,22 @@ func Test_edit_insert_reg()
   close!
 endfunc
 
+" Test for positioning cursor after CTRL-R expression failed
+func Test_edit_ctrl_r_failed()
+  CheckRunVimInTerminal
+
+  let buf = RunVimInTerminal('', #{rows: 6, cols: 60})
+
+  " trying to insert a dictionary produces an error
+  call term_sendkeys(buf, "i\<C-R>={}\<CR>")
+
+  " ending Insert mode should put the cursor back on the ':'
+  call term_sendkeys(buf, ":\<Esc>")
+  call VerifyScreenDump(buf, 'Test_edit_ctlr_r_failed_1', {})
+
+  call StopVimInTerminal(buf)
+endfunc
+
 " When a character is inserted at the last position of the last line in a
 " window, the window contents should be scrolled one line up. If the top line
 " is part of a fold, then the entire fold should be scrolled up.