summaryrefslogtreecommitdiffstats
path: root/src/testdir/test_autocmd.vim
diff options
context:
space:
mode:
authorBram Moolenaar <Bram@vim.org>2022-07-27 15:23:35 +0100
committerBram Moolenaar <Bram@vim.org>2022-07-27 15:23:35 +0100
commit3d6ee8bda0550a01346f5992bbce09c0eb6d7569 (patch)
tree1bc029d00d152ae32522ed705cc5da8cd6c190d4 /src/testdir/test_autocmd.vim
parent7abd1c6d8e777bde1700633bafc1a40be9e9c1aa (diff)
patch 9.0.0094: cursor restored unexpected with nested autocommandv9.0.0094
Problem: Cursor restored unexpected with nested autocommand. Solution: Do not restore the cursor when it was moved intentionally. (closes #10780)
Diffstat (limited to 'src/testdir/test_autocmd.vim')
-rw-r--r--src/testdir/test_autocmd.vim11
1 files changed, 11 insertions, 0 deletions
diff --git a/src/testdir/test_autocmd.vim b/src/testdir/test_autocmd.vim
index f7763e6bd1..6bbe48c0f2 100644
--- a/src/testdir/test_autocmd.vim
+++ b/src/testdir/test_autocmd.vim
@@ -2321,6 +2321,17 @@ func Test_autocmd_nested_cursor_invalid()
bwipe!
endfunc
+func Test_autocmd_nested_keeps_cursor_pos()
+ enew
+ call setline(1, 'foo')
+ autocmd User foo ++nested normal! $a
+ autocmd InsertLeave * :
+ doautocmd User foo
+ call assert_equal([0, 1, 3, 0], getpos('.'))
+
+ bwipe!
+endfunc
+
func Test_autocmd_nested_switch_window()
" run this in a separate Vim so that SafeState works
CheckRunVimInTerminal