diff options
| author | zeertzjq <zeertzjq@outlook.com> | 2022-07-28 12:22:00 +0800 |
|---|---|---|
| committer | GitHub <noreply@github.com> | 2022-07-28 12:22:00 +0800 |
| commit | fe254fb7e7a8c143be581aa2f696770423595343 (patch) | |
| tree | e5d2abb911d65b1eb2761e4cb5c2109867ebbcbf /src/nvim/testdir | |
| parent | bdbf843031b91db7ab0d4ad925c8652947d38b70 (diff) | |
| parent | 0134a2cb3eaf03cbf845a5f9c13a153e4ef9b6b6 (diff) | |
| download | rneovim-fe254fb7e7a8c143be581aa2f696770423595343.tar.gz rneovim-fe254fb7e7a8c143be581aa2f696770423595343.tar.bz2 rneovim-fe254fb7e7a8c143be581aa2f696770423595343.zip | |
Merge pull request #19556 from zeertzjq/vim-9.0.0061
vim-patch:9.0.{0061,partial:0077,0094}
Diffstat (limited to 'src/nvim/testdir')
| -rw-r--r-- | src/nvim/testdir/test_autocmd.vim | 51 |
1 files changed, 51 insertions, 0 deletions
diff --git a/src/nvim/testdir/test_autocmd.vim b/src/nvim/testdir/test_autocmd.vim index cf14c85d03..1c2f86a584 100644 --- a/src/nvim/testdir/test_autocmd.vim +++ b/src/nvim/testdir/test_autocmd.vim @@ -2170,6 +2170,57 @@ func Test_autocmd_nested() call assert_fails('au WinNew * nested nested echo bad', 'E983:') endfunc +func Test_autocmd_nested_cursor_invalid() + set laststatus=0 + copen + cclose + call setline(1, ['foo', 'bar', 'baz']) + 3 + augroup nested_inv + autocmd User foo ++nested copen + autocmd BufAdd * let &laststatus = 2 - &laststatus + augroup END + doautocmd User foo + + augroup nested_inv + au! + augroup END + set laststatus& + cclose + 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 + + let lines =<< trim END + vim9script + ['()']->writefile('Xautofile') + autocmd VimEnter * ++nested edit Xautofile | split + autocmd BufReadPost * autocmd SafeState * ++once foldclosed('.') + autocmd WinEnter * matchadd('ErrorMsg', 'pat') + END + call writefile(lines, 'Xautoscript') + let buf = RunVimInTerminal('-S Xautoscript', {'rows': 10}) + call VerifyScreenDump(buf, 'Test_autocmd_nested_switch', {}) + + call StopVimInTerminal(buf) + call delete('Xautofile') + call delete('Xautoscript') +endfunc + func Test_autocmd_once() " Without ++once WinNew triggers twice let g:did_split = 0 |