# HG changeset patch # User Bram Moolenaar # Date 1657815306 -7200 # Node ID b43cb3fd0c7bf4278667e23efd6e61203fb46f9d # Parent eee6d731c2da572478c125b9a418fee9b235101f patch 9.0.0051: using CTRL-C wih :append may hang Vim Commit: https://github.com/vim/vim/commit/f754fe6a3d5384b5146c38a32db6da9d46e00c40 Author: zeertzjq Date: Thu Jul 14 17:06:12 2022 +0100 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 https://github.com/vim/vim/issues/10729, closes https://github.com/vim/vim/issues/10728) diff --git a/src/ex_getln.c b/src/ex_getln.c --- a/src/ex_getln.c +++ b/src/ex_getln.c @@ -1786,6 +1786,8 @@ 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); diff --git a/src/testdir/test_ex_mode.vim b/src/testdir/test_ex_mode.vim --- a/src/testdir/test_ex_mode.vim +++ b/src/testdir/test_ex_mode.vim @@ -145,6 +145,29 @@ func Test_Ex_global() bwipe! 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)\") + call term_sendkeys(buf, "append\") + call WaitForAssert({-> assert_match(': append', term_getline(buf, 5))}, 1000) + call term_sendkeys(buf, "\") + call term_wait(buf) + call term_sendkeys(buf, "foo\") + call WaitForAssert({-> assert_match('foo', term_getline(buf, 5))}, 1000) + call term_sendkeys(buf, ".\") + call WaitForAssert({-> assert_match('.', term_getline(buf, 5))}, 1000) + call term_sendkeys(buf, "endfor\") + call term_sendkeys(buf, "vi\") + call WaitForAssert({-> assert_match('foo', term_getline(buf, 1))}, 1000) + + call StopVimInTerminal(buf) +endfunc + " In Ex-mode, a backslash escapes a newline func Test_Ex_escape_enter() call feedkeys("gQlet l = \"a\\\b\"\vi\", 'xt') diff --git a/src/version.c b/src/version.c --- 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 */ /**/ + 51, +/**/ 50, /**/ 49,