Skip to content

Commit

Permalink
patch 8.2.4672: using :normal with Ex mode may make :substitute hang
Browse files Browse the repository at this point in the history
Problem:    Using :normal with Ex mode may make :substitute hang.
Solution:   When getting an empty line behave like 'q' was typed.
            (closes #10070)
  • Loading branch information
brammool committed Apr 3, 2022
1 parent a3157a4 commit ce416b4
Show file tree
Hide file tree
Showing 3 changed files with 16 additions and 0 deletions.
5 changes: 5 additions & 0 deletions src/ex_cmds.c
Original file line number Diff line number Diff line change
Expand Up @@ -4233,6 +4233,11 @@ ex_substitute(exarg_T *eap)
{
typed = *resp;
vim_free(resp);
// When ":normal" runs out of characters we get
// an empty line. Use "q" to get out of the
// loop.
if (ex_normal_busy && typed == NUL)
typed = 'q';
}
}
else
Expand Down
9 changes: 9 additions & 0 deletions src/testdir/test_normal.vim
Original file line number Diff line number Diff line change
Expand Up @@ -2641,6 +2641,15 @@ func Test_normal33_g_cmd2()
bw!
endfunc

func Test_normal_ex_substitute()
" This was hanging on the substitute prompt.
new
call setline(1, 'a')
exe "normal! gggQs/a/b/c\<CR>"
call assert_equal('a', getline(1))
bwipe!
endfunc

" Test for g CTRL-G
func Test_g_ctrl_g()
new
Expand Down
2 changes: 2 additions & 0 deletions src/version.c
Original file line number Diff line number Diff line change
Expand Up @@ -750,6 +750,8 @@ static char *(features[]) =

static int included_patches[] =
{ /* Add new patch number below this line */
/**/
4672,
/**/
4671,
/**/
Expand Down

0 comments on commit ce416b4

Please sign in to comment.