Mercurial > vim
diff src/testdir/test_global.vim @ 29481:34bb46847ba0 v9.0.0082
patch 9.0.0082: cannot interrupt global command from command line
Commit: https://github.com/vim/vim/commit/3cfae39b087c2724991d385e5e8ee7d011aa8e99
Author: zeertzjq <zeertzjq@outlook.com>
Date: Tue Jul 26 17:48:13 2022 +0100
patch 9.0.0082: cannot interrupt global command from command line
Problem: Cannot interrupt global command from command line.
Solution: Reset got_int in another place. (closes https://github.com/vim/vim/issues/10739)
author | Bram Moolenaar <Bram@vim.org> |
---|---|
date | Tue, 26 Jul 2022 19:00:03 +0200 |
parents | 0fa3be75ddc7 |
children | 2c169fec56f2 |
line wrap: on
line diff
--- a/src/testdir/test_global.vim +++ b/src/testdir/test_global.vim @@ -1,6 +1,7 @@ " Test for :global and :vglobal source check.vim +source term_util.vim func Test_yank_put_clipboard() new @@ -107,4 +108,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