patch 8.2.1679: Vim9: ":*" is not recognized as a range
Problem: Vim9: ":*" is not recognized as a range.
Solution: Move recognizing "*" into skip_range(). (closes #6838)
diff --git a/src/ex_docmd.c b/src/ex_docmd.c
index 6495db6..ed52b46 100644
--- a/src/ex_docmd.c
+++ b/src/ex_docmd.c
@@ -1779,9 +1779,7 @@
may_have_range = !vim9script || starts_with_colon;
if (may_have_range)
#endif
- ea.cmd = skip_range(ea.cmd, NULL);
- if (*ea.cmd == '*' && vim_strchr(p_cpo, CPO_STAR) == NULL)
- ea.cmd = skipwhite(ea.cmd + 1);
+ ea.cmd = skip_range(ea.cmd, TRUE, NULL);
#ifdef FEAT_EVAL
if (vim9script && !starts_with_colon)
@@ -2683,7 +2681,7 @@
return FAIL;
}
- p = skip_range(eap->cmd, NULL);
+ p = skip_range(eap->cmd, TRUE, NULL);
switch (*p)
{
// When adding an entry, also modify cmd_exists().
@@ -3534,7 +3532,8 @@
char_u *
skip_range(
char_u *cmd,
- int *ctx) // pointer to xp_context or NULL
+ int skip_star, // skip "*" used for Visual range
+ int *ctx) // pointer to xp_context or NULL
{
unsigned delim;
@@ -3569,6 +3568,10 @@
while (*cmd == ':')
cmd = skipwhite(cmd + 1);
+ // Skip "*" used for Visual range.
+ if (skip_star && *cmd == '*' && vim_strchr(p_cpo, CPO_STAR) == NULL)
+ cmd = skipwhite(cmd + 1);
+
return cmd;
}