From: Martin Tournoij Date: Sat, 22 Oct 2022 08:02:56 +0000 (+0100) Subject: patch 9.0.0815 X-Git-Tag: v9.0.0814436e5d395f X-Git-Url: https://granicus.if.org/sourcecode?a=commitdiff_plain;h=9c50eeb40117413bf59a9da904c8d0921ed0a6e6;p=vim patch 9.0.0815 --- diff --git a/src/ex_cmds.c b/src/ex_cmds.c index 93f9dd700..676ab704b 100644 --- a/src/ex_cmds.c +++ b/src/ex_cmds.c @@ -929,6 +929,8 @@ do_bang( STRCAT(t, newcmd); if (ins_prevcmd) STRCAT(t, prevcmd); + else + vim_free(t); p = t + STRLEN(t); STRCAT(t, trailarg); vim_free(newcmd); @@ -957,17 +959,13 @@ do_bang( } } while (trailarg != NULL); - // Don't do anything if there is no command as there isn't really anything - // useful in running "sh -c ''". Avoids changing "prevcmd". - if (STRLEN(newcmd) == 0) + // Don't clear "prevcmd" if there is no command to run. + if (STRLEN(newcmd) > 0) { - vim_free(newcmd); - return; + vim_free(prevcmd); + prevcmd = newcmd; } - vim_free(prevcmd); - prevcmd = newcmd; - if (bangredo) // put cmd in redo buffer for ! command { // If % or # appears in the command, it must have been escaped. diff --git a/src/testdir/test_shell.vim b/src/testdir/test_shell.vim index 1b4b1f980..3ac4681e3 100644 --- a/src/testdir/test_shell.vim +++ b/src/testdir/test_shell.vim @@ -268,8 +268,8 @@ func Test_shell_repeat() call assert_equal(['Cmd: [-c echo coconut]'], readfile('Xlog')) call writefile(['empty'], 'Xlog') - call feedkeys(":!\", 'xt') " :! is a no-op - call assert_equal(['empty'], readfile('Xlog')) + call feedkeys(":!\", 'xt') " :! + call assert_equal(['Cmd: [-c ]'], readfile('Xlog')) call feedkeys(":!!\", 'xt') " :! doesn't clear previous command call assert_equal(['Cmd: [-c echo coconut]'], readfile('Xlog')) diff --git a/src/version.c b/src/version.c index 690a1973a..237cd7c40 100644 --- a/src/version.c +++ b/src/version.c @@ -695,6 +695,8 @@ static char *(features[]) = static int included_patches[] = { /* Add new patch number below this line */ +/**/ + 815, /**/ 814, /**/