mirror of
https://github.com/vim/vim.git
synced 2025-09-24 03:44:06 -04:00
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)
This commit is contained in:
@@ -1875,10 +1875,10 @@ EXCMD(CMD_X, "X", ex_X,
|
|||||||
|
|
||||||
// Commands that are recognized only in find_ex_command().
|
// Commands that are recognized only in find_ex_command().
|
||||||
EXCMD(CMD_increment, "++", ex_incdec,
|
EXCMD(CMD_increment, "++", ex_incdec,
|
||||||
EX_EXTRA|EX_NOTRLCOM|EX_SBOXOK|EX_CMDWIN|EX_LOCK_OK,
|
EX_EXTRA|EX_TRLBAR|EX_SBOXOK|EX_CMDWIN|EX_LOCK_OK,
|
||||||
ADDR_NONE),
|
ADDR_NONE),
|
||||||
EXCMD(CMD_decrement, "--", ex_incdec,
|
EXCMD(CMD_decrement, "--", ex_incdec,
|
||||||
EX_EXTRA|EX_NOTRLCOM|EX_SBOXOK|EX_CMDWIN|EX_LOCK_OK,
|
EX_EXTRA|EX_TRLBAR|EX_SBOXOK|EX_CMDWIN|EX_LOCK_OK,
|
||||||
ADDR_NONE),
|
ADDR_NONE),
|
||||||
|
|
||||||
#undef EXCMD
|
#undef EXCMD
|
||||||
|
@@ -1889,6 +1889,10 @@ def Test_inc_dec()
|
|||||||
assert_equal(8, nr)
|
assert_equal(8, nr)
|
||||||
--nr
|
--nr
|
||||||
assert_equal(7, nr)
|
assert_equal(7, nr)
|
||||||
|
++nr | ++nr
|
||||||
|
assert_equal(9, nr)
|
||||||
|
++nr # comment
|
||||||
|
assert_equal(10, nr)
|
||||||
|
|
||||||
var ll = [1, 2]
|
var ll = [1, 2]
|
||||||
--ll[0]
|
--ll[0]
|
||||||
|
@@ -755,6 +755,8 @@ static char *(features[]) =
|
|||||||
|
|
||||||
static int included_patches[] =
|
static int included_patches[] =
|
||||||
{ /* Add new patch number below this line */
|
{ /* Add new patch number below this line */
|
||||||
|
/**/
|
||||||
|
3047,
|
||||||
/**/
|
/**/
|
||||||
3046,
|
3046,
|
||||||
/**/
|
/**/
|
||||||
|
@@ -166,19 +166,23 @@ vim9_comment_start(char_u *p)
|
|||||||
ex_incdec(exarg_T *eap)
|
ex_incdec(exarg_T *eap)
|
||||||
{
|
{
|
||||||
char_u *cmd = eap->cmd;
|
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".
|
// This works like "nr += 1" or "nr -= 1".
|
||||||
|
// Add a '|' to avoid looking in the next line.
|
||||||
eap->cmd = alloc(len);
|
eap->cmd = alloc(len);
|
||||||
if (eap->cmd == NULL)
|
if (eap->cmd == NULL)
|
||||||
return;
|
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->cmdidx == CMD_increment ? '+' : '-');
|
||||||
eap->arg = eap->cmd;
|
eap->arg = eap->cmd;
|
||||||
eap->cmdidx = CMD_var;
|
eap->cmdidx = CMD_var;
|
||||||
|
eap->nextcmd = NULL;
|
||||||
ex_let(eap);
|
ex_let(eap);
|
||||||
vim_free(eap->cmd);
|
vim_free(eap->cmd);
|
||||||
eap->cmd = cmd;
|
eap->cmd = cmd;
|
||||||
|
eap->nextcmd = nextcmd;
|
||||||
}
|
}
|
||||||
|
|
||||||
/*
|
/*
|
||||||
|
Reference in New Issue
Block a user