aboutsummaryrefslogtreecommitdiff
path: root/test/functional/legacy/edit_spec.lua
diff options
context:
space:
mode:
authorzeertzjq <zeertzjq@outlook.com>2023-03-26 09:24:04 +0800
committerGitHub <noreply@github.com>2023-03-26 09:24:04 +0800
commit4eef5ac453866dae7c03f5432fc8c4dfcda19f54 (patch)
tree5659978e15435ae63f445fabef685853e78b28ea /test/functional/legacy/edit_spec.lua
parente3dab4b32609c63adfbb6bb425a4b19c1ff95cde (diff)
downloadrneovim-4eef5ac453866dae7c03f5432fc8c4dfcda19f54.tar.gz
rneovim-4eef5ac453866dae7c03f5432fc8c4dfcda19f54.tar.bz2
rneovim-4eef5ac453866dae7c03f5432fc8c4dfcda19f54.zip
vim-patch:9.0.1428: cursor in wrong position when leaving insert mode (#22786)
Problem: Cursor in wrong position when leaving insert mode. Solution: Update the w_valid flags. Position the cursor also when not redrawing. (closes vim/vim#12137) https://github.com/vim/vim/commit/c174c2e58c9e24a75b189e01143e6d057b84e96e Co-authored-by: Bram Moolenaar <Bram@vim.org>
Diffstat (limited to 'test/functional/legacy/edit_spec.lua')
-rw-r--r--test/functional/legacy/edit_spec.lua64
1 files changed, 64 insertions, 0 deletions
diff --git a/test/functional/legacy/edit_spec.lua b/test/functional/legacy/edit_spec.lua
index 362d33a0fd..a0d8ca63a2 100644
--- a/test/functional/legacy/edit_spec.lua
+++ b/test/functional/legacy/edit_spec.lua
@@ -55,4 +55,68 @@ describe('edit', function()
=^ |
]])
end)
+
+ -- oldtest: Test_edit_ctrl_r_failed()
+ it('positioning cursor after CTRL-R expression failed', function()
+ local screen = Screen.new(60, 6)
+ screen:set_default_attr_ids({
+ [0] = {bold = true, foreground = Screen.colors.Blue}, -- NonText
+ [1] = {foreground = Screen.colors.Blue}, -- SpecialKey
+ [2] = {foreground = Screen.colors.SlateBlue},
+ [3] = {bold = true}, -- ModeMsg
+ [4] = {reverse = true, bold = true}, -- MsgSeparator
+ [5] = {background = Screen.colors.Red, foreground = Screen.colors.White}, -- ErrorMsg
+ [6] = {foreground = Screen.colors.SeaGreen, bold = true}, -- MoreMsg
+ })
+ screen:attach()
+
+ feed('i<C-R>')
+ screen:expect([[
+ {1:^"} |
+ {0:~ }|
+ {0:~ }|
+ {0:~ }|
+ {0:~ }|
+ {3:-- INSERT --} |
+ ]])
+ feed('={}')
+ screen:expect([[
+ {1:"} |
+ {0:~ }|
+ {0:~ }|
+ {0:~ }|
+ {0:~ }|
+ ={2:{}}^ |
+ ]])
+ -- trying to insert a dictionary produces an error
+ feed('<CR>')
+ screen:expect([[
+ {1:"} |
+ {0:~ }|
+ {4: }|
+ ={2:{}} |
+ {5:E731: using Dictionary as a String} |
+ {6:Press ENTER or type command to continue}^ |
+ ]])
+
+ feed(':')
+ screen:expect([[
+ :^ |
+ {0:~ }|
+ {0:~ }|
+ {0:~ }|
+ {0:~ }|
+ {3:-- INSERT --} |
+ ]])
+ -- ending Insert mode should put the cursor back on the ':'
+ feed('<Esc>')
+ screen:expect([[
+ ^: |
+ {0:~ }|
+ {0:~ }|
+ {0:~ }|
+ {0:~ }|
+ |
+ ]])
+ end)
end)