aboutsummaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorzeertzjq <zeertzjq@outlook.com>2023-04-18 14:23:09 +0800
committerzeertzjq <zeertzjq@outlook.com>2023-04-18 14:29:07 +0800
commit187ba3efce4acc197ce6cc9559a905eec97bacbe (patch)
tree510aeef3ca3898c5597f40bc89e6d7246c29bb9b /src
parent5b77dde8dd281b1db1f503d9b270c3697f88bd65 (diff)
downloadrneovim-187ba3efce4acc197ce6cc9559a905eec97bacbe.tar.gz
rneovim-187ba3efce4acc197ce6cc9559a905eec97bacbe.tar.bz2
rneovim-187ba3efce4acc197ce6cc9559a905eec97bacbe.zip
vim-patch:9.0.0815
https://github.com/vim/vim/commit/9c50eeb40117413bf59a9da904c8d0921ed0a6e6 Co-authored-by: Martin Tournoij <martin@arp242.net>
Diffstat (limited to 'src')
-rw-r--r--src/nvim/ex_cmds.c14
1 files changed, 6 insertions, 8 deletions
diff --git a/src/nvim/ex_cmds.c b/src/nvim/ex_cmds.c
index 015f651872..f7447cda1b 100644
--- a/src/nvim/ex_cmds.c
+++ b/src/nvim/ex_cmds.c
@@ -988,6 +988,8 @@ void do_bang(int addr_count, exarg_T *eap, bool forceit, bool do_in, bool do_out
}
if (ins_prevcmd) {
STRCAT(t, prevcmd);
+ } else {
+ xfree(t);
}
p = t + strlen(t);
STRCAT(t, trailarg);
@@ -1012,16 +1014,12 @@ void do_bang(int addr_count, exarg_T *eap, bool forceit, bool do_in, bool do_out
}
} 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) {
- xfree(newcmd);
- return;
+ // Don't clear "prevcmd" if there is no command to run.
+ if (strlen(newcmd) > 0) {
+ xfree(prevcmd);
+ prevcmd = newcmd;
}
- xfree(prevcmd);
- prevcmd = newcmd;
-
if (bangredo) { // put cmd in redo buffer for ! command
// If % or # appears in the command, it must have been escaped.
// Reescape them, so that redoing them does not substitute them by the