patch 8.2.3047: increment and decrement don't allow for next command
Problem: Increment and decrement don't allow for next command.
Solution: Allow for comment and next command. (closes #8442)
diff --git a/src/vim9script.c b/src/vim9script.c
index 7078cbe..7c6526b 100644
--- a/src/vim9script.c
+++ b/src/vim9script.c
@@ -166,19 +166,23 @@
ex_incdec(exarg_T *eap)
{
char_u *cmd = eap->cmd;
- size_t len = STRLEN(eap->cmd) + 6;
+ char_u *nextcmd = eap->nextcmd;
+ size_t len = STRLEN(eap->cmd) + 8;
// This works like "nr += 1" or "nr -= 1".
+ // Add a '|' to avoid looking in the next line.
eap->cmd = alloc(len);
if (eap->cmd == NULL)
return;
- vim_snprintf((char *)eap->cmd, len, "%s %c= 1", cmd + 2,
+ vim_snprintf((char *)eap->cmd, len, "%s %c= 1 |", cmd + 2,
eap->cmdidx == CMD_increment ? '+' : '-');
eap->arg = eap->cmd;
eap->cmdidx = CMD_var;
+ eap->nextcmd = NULL;
ex_let(eap);
vim_free(eap->cmd);
eap->cmd = cmd;
+ eap->nextcmd = nextcmd;
}
/*