@@ -145,6 +145,29 @@ func Test_Ex_global()
145145 bwipe!
146146endfunc
147147
148+ " Test for pressing Ctrl-C in :append inside a loop in Ex mode
149+ " This used to hang Vim
150+ func Test_Ex_append_in_loop ()
151+ CheckRunVimInTerminal
152+ let buf = RunVimInTerminal (' ' , {' rows' : 6 })
153+
154+ call term_sendkeys (buf , " gQ" )
155+ call term_sendkeys (buf , " for i in range(1)\<CR> " )
156+ call term_sendkeys (buf , " append\<CR> " )
157+ call WaitForAssert ({- > assert_match (' : append' , term_getline (buf , 5 ))}, 1000 )
158+ call term_sendkeys (buf , " \<C-C> " )
159+ call term_wait (buf )
160+ call term_sendkeys (buf , " foo\<CR> " )
161+ call WaitForAssert ({- > assert_match (' foo' , term_getline (buf , 5 ))}, 1000 )
162+ call term_sendkeys (buf , " .\<CR> " )
163+ call WaitForAssert ({- > assert_match (' .' , term_getline (buf , 5 ))}, 1000 )
164+ call term_sendkeys (buf , " endfor\<CR> " )
165+ call term_sendkeys (buf , " vi\<CR> " )
166+ call WaitForAssert ({- > assert_match (' foo' , term_getline (buf , 1 ))}, 1000 )
167+
168+ call StopVimInTerminal (buf )
169+ endfunc
170+
148171" In Ex-mode, a backslash escapes a newline
149172func Test_Ex_escape_enter ()
150173 call feedkeys (" gQlet l = \" a\\ \<kEnter> b\" \<cr> vi\<cr> " , ' xt' )
0 commit comments