Mercurial > vim
diff src/testdir/test_autocmd.vim @ 29505:33983b2f030f v9.0.0094
patch 9.0.0094: cursor restored unexpected with nested autocommand
Commit: https://github.com/vim/vim/commit/3d6ee8bda0550a01346f5992bbce09c0eb6d7569
Author: Bram Moolenaar <Bram@vim.org>
Date: Wed Jul 27 15:23:35 2022 +0100
patch 9.0.0094: cursor restored unexpected with nested autocommand
Problem: Cursor restored unexpected with nested autocommand.
Solution: Do not restore the cursor when it was moved intentionally.
(closes #10780)
author | Bram Moolenaar <Bram@vim.org> |
---|---|
date | Wed, 27 Jul 2022 16:30:03 +0200 |
parents | 2a327999c05c |
children | 6eaef7375f17 |
line wrap: on
line diff
--- 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