summaryrefslogtreecommitdiffstats
path: root/src/ex_cmds.c
diff options
context:
space:
mode:
authorMartin Tournoij <martin@arp242.net>2022-10-22 09:02:56 +0100
committerBram Moolenaar <Bram@vim.org>2022-10-22 09:02:56 +0100
commit9c50eeb40117413bf59a9da904c8d0921ed0a6e6 (patch)
treec7ffa39307f8984d9123ff831836f93cdd79aeac /src/ex_cmds.c
parent436e5d395fd629c8d33b5cf7b373aad007f16851 (diff)
patch 9.0.0815v9.0.0815
Diffstat (limited to 'src/ex_cmds.c')
-rw-r--r--src/ex_cmds.c14
1 files changed, 6 insertions, 8 deletions
diff --git a/src/ex_cmds.c b/src/ex_cmds.c
index 93f9dd700c..676ab704b3 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.