diff options
author | zeertzjq <zeertzjq@outlook.com> | 2022-07-26 17:48:13 +0100 |
---|---|---|
committer | Bram Moolenaar <Bram@vim.org> | 2022-07-26 17:48:13 +0100 |
commit | 3cfae39b087c2724991d385e5e8ee7d011aa8e99 (patch) | |
tree | 02d735f2d2857d9d94f59efc339128c04d059386 /src | |
parent | c2842adfb2ca0637f13e2793fefa18e7818684f9 (diff) |
patch 9.0.0082: cannot interrupt global command from command linev9.0.0082
Problem: Cannot interrupt global command from command line.
Solution: Reset got_int in another place. (closes #10739)
Diffstat (limited to 'src')
-rw-r--r-- | src/ex_getln.c | 5 | ||||
-rw-r--r-- | src/testdir/test_ex_mode.vim | 1 | ||||
-rw-r--r-- | src/testdir/test_global.vim | 28 | ||||
-rw-r--r-- | src/version.c | 2 |
4 files changed, 33 insertions, 3 deletions
diff --git a/src/ex_getln.c b/src/ex_getln.c index dd538941ef..7fbfded1f2 100644 --- a/src/ex_getln.c +++ b/src/ex_getln.c @@ -1786,8 +1786,6 @@ getcmdline_int( // that occurs while typing a command should // cause the command not to be executed. - got_int = FALSE; // avoid infinite Ctrl-C loop in Ex mode - // Trigger SafeState if nothing is pending. may_trigger_safestate(xpc.xp_numfiles <= 0); @@ -1850,7 +1848,8 @@ getcmdline_int( && firstc != '@' #endif #ifdef FEAT_EVAL - && !break_ctrl_c + // do clear got_int in Ex mode to avoid infinite Ctrl-C loop + && (!break_ctrl_c || exmode_active) #endif && !global_busy) got_int = FALSE; diff --git a/src/testdir/test_ex_mode.vim b/src/testdir/test_ex_mode.vim index 50bc1db997..2e14e01fa3 100644 --- a/src/testdir/test_ex_mode.vim +++ b/src/testdir/test_ex_mode.vim @@ -156,6 +156,7 @@ func Test_Ex_append_in_loop() call term_sendkeys(buf, "append\<CR>") call WaitForAssert({-> assert_match(': append', term_getline(buf, 5))}, 1000) call term_sendkeys(buf, "\<C-C>") + " Wait for input to be flushed call term_wait(buf) call term_sendkeys(buf, "foo\<CR>") call WaitForAssert({-> assert_match('foo', term_getline(buf, 5))}, 1000) diff --git a/src/testdir/test_global.vim b/src/testdir/test_global.vim index 62f588afb8..75b56e033f 100644 --- 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 diff --git a/src/version.c b/src/version.c index ad0c1a9dd2..1ecfefceb3 100644 --- a/src/version.c +++ b/src/version.c @@ -736,6 +736,8 @@ static char *(features[]) = static int included_patches[] = { /* Add new patch number below this line */ /**/ + 82, +/**/ 81, /**/ 80, |