0
0
mirror of https://github.com/vim/vim.git synced 2025-07-26 11:04:33 -04:00

patch 9.0.0051: using CTRL-C wih :append may hang Vim

Problem:    Using CTRL-C wih :append may hang Vim.
Solution:   Reset got_int. (closes #10729, closes #10728)
This commit is contained in:
zeertzjq 2022-07-14 17:06:12 +01:00 committed by Bram Moolenaar
parent b26592a84c
commit f754fe6a3d
3 changed files with 27 additions and 0 deletions

View File

@ -1786,6 +1786,8 @@ getcmdline_int(
// that occurs while typing a command should // that occurs while typing a command should
// cause the command not to be executed. // cause the command not to be executed.
got_int = FALSE; // avoid infinite Ctrl-C loop in Ex mode
// Trigger SafeState if nothing is pending. // Trigger SafeState if nothing is pending.
may_trigger_safestate(xpc.xp_numfiles <= 0); may_trigger_safestate(xpc.xp_numfiles <= 0);

View File

@ -145,6 +145,29 @@ func Test_Ex_global()
bwipe! bwipe!
endfunc endfunc
" Test for pressing Ctrl-C in :append inside a loop in Ex mode
" This used to hang Vim
func Test_Ex_append_in_loop()
CheckRunVimInTerminal
let buf = RunVimInTerminal('', {'rows': 6})
call term_sendkeys(buf, "gQ")
call term_sendkeys(buf, "for i in range(1)\<CR>")
call term_sendkeys(buf, "append\<CR>")
call WaitForAssert({-> assert_match(': append', term_getline(buf, 5))}, 1000)
call term_sendkeys(buf, "\<C-C>")
call term_wait(buf)
call term_sendkeys(buf, "foo\<CR>")
call WaitForAssert({-> assert_match('foo', term_getline(buf, 5))}, 1000)
call term_sendkeys(buf, ".\<CR>")
call WaitForAssert({-> assert_match('.', term_getline(buf, 5))}, 1000)
call term_sendkeys(buf, "endfor\<CR>")
call term_sendkeys(buf, "vi\<CR>")
call WaitForAssert({-> assert_match('foo', term_getline(buf, 1))}, 1000)
call StopVimInTerminal(buf)
endfunc
" In Ex-mode, a backslash escapes a newline " In Ex-mode, a backslash escapes a newline
func Test_Ex_escape_enter() func Test_Ex_escape_enter()
call feedkeys("gQlet l = \"a\\\<kEnter>b\"\<cr>vi\<cr>", 'xt') call feedkeys("gQlet l = \"a\\\<kEnter>b\"\<cr>vi\<cr>", 'xt')

View File

@ -735,6 +735,8 @@ static char *(features[]) =
static int included_patches[] = static int included_patches[] =
{ /* Add new patch number below this line */ { /* Add new patch number below this line */
/**/
51,
/**/ /**/
50, 50,
/**/ /**/