diff options
Diffstat (limited to 'src/nvim/testdir/test_global.vim')
-rw-r--r-- | src/nvim/testdir/test_global.vim | 30 |
1 files changed, 30 insertions, 0 deletions
diff --git a/src/nvim/testdir/test_global.vim b/src/nvim/testdir/test_global.vim index feddf85346..947f7efc7c 100644 --- a/src/nvim/testdir/test_global.vim +++ b/src/nvim/testdir/test_global.vim @@ -1,4 +1,7 @@ +" Test for :global and :vglobal + source check.vim +source term_util.vim func Test_yank_put_clipboard() new @@ -82,4 +85,31 @@ func Test_wrong_delimiter() call assert_fails('g x^bxd', 'E146:') endfunc +" Test for interrupting :global using Ctrl-C +func Test_interrupt_global() + CheckRunVimInTerminal + let lines =<< trim END + cnoremap ; <Cmd>sleep 10<CR> + call setline(1, repeat(['foo'], 5)) + END + call writefile(lines, 'Xtest_interrupt_global') + let buf = RunVimInTerminal('-S Xtest_interrupt_global', {'rows': 6}) + + call term_sendkeys(buf, ":g/foo/norm :\<C-V>;\<CR>") + " Wait for :sleep to start + call term_wait(buf) + call term_sendkeys(buf, "\<C-C>") + call WaitForAssert({-> assert_match('Interrupted', term_getline(buf, 6))}, 1000) + + " Also test in Ex mode + call term_sendkeys(buf, "gQg/foo/norm :\<C-V>;\<CR>") + " Wait for :sleep to start + call term_wait(buf) + call term_sendkeys(buf, "\<C-C>") + call WaitForAssert({-> assert_match('Interrupted', term_getline(buf, 5))}, 1000) + + call StopVimInTerminal(buf) + call delete('Xtest_interrupt_global') +endfunc + " vim: shiftwidth=2 sts=2 expandtab |