0
0
mirror of https://github.com/vim/vim.git synced 2025-09-23 03:43:49 -04:00

patch 8.2.3694: cannot use quotes in the count of an Ex command

Problem:    Cannot use quotes in the count of an Ex command.
Solution:   Add getdigits_quoted().  Give an error when misplacing a quote in
            a range. (closes #9240)
This commit is contained in:
Bram Moolenaar
2021-11-29 12:12:43 +00:00
parent 293eb9ba46
commit af377e34b0
5 changed files with 78 additions and 3 deletions

View File

@@ -2402,7 +2402,7 @@ do_one_cmd(
&& (!(ea.argt & EX_BUFNAME) || *(p = skipdigits(ea.arg + 1)) == NUL
|| VIM_ISWHITE(*p)))
{
n = getdigits(&ea.arg);
n = getdigits_quoted(&ea.arg);
ea.arg = skipwhite(ea.arg);
if (n <= 0 && !ni && (ea.argt & EX_ZEROR) == 0)
{
@@ -3950,10 +3950,11 @@ excmd_get_argt(cmdidx_T idx)
*/
char_u *
skip_range(
char_u *cmd,
char_u *cmd_start,
int skip_star, // skip "*" used for Visual range
int *ctx) // pointer to xp_context or NULL
{
char_u *cmd = cmd_start;
unsigned delim;
while (vim_strchr((char_u *)" \t0123456789.$%'/?-+,;\\", *cmd) != NULL)
@@ -3967,6 +3968,17 @@ skip_range(
}
else if (*cmd == '\'')
{
char_u *p = cmd;
// a quote is only valid at the start or after a separator
while (p > cmd_start)
{
--p;
if (!VIM_ISWHITE(*p))
break;
}
if (cmd > cmd_start && !VIM_ISWHITE(*p) && *p != ',' && *p != ';')
break;
if (*++cmd == NUL && ctx != NULL)
*ctx = EXPAND_NOTHING;
}