mirror of
https://github.com/vim/vim.git
synced 2025-07-26 11:04:33 -04:00
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)
This commit is contained in:
parent
d1f76afaf9
commit
3bd8de40b4
@ -992,7 +992,7 @@ set_one_cmd_context(
|
|||||||
}
|
}
|
||||||
|
|
||||||
// 3. Skip over the range to find the command.
|
// 3. Skip over the range to find the command.
|
||||||
cmd = skip_range(cmd, &xp->xp_context);
|
cmd = skip_range(cmd, TRUE, &xp->xp_context);
|
||||||
xp->xp_pattern = cmd;
|
xp->xp_pattern = cmd;
|
||||||
if (*cmd == NUL)
|
if (*cmd == NUL)
|
||||||
return NULL;
|
return NULL;
|
||||||
|
@ -1779,9 +1779,7 @@ do_one_cmd(
|
|||||||
may_have_range = !vim9script || starts_with_colon;
|
may_have_range = !vim9script || starts_with_colon;
|
||||||
if (may_have_range)
|
if (may_have_range)
|
||||||
#endif
|
#endif
|
||||||
ea.cmd = skip_range(ea.cmd, NULL);
|
ea.cmd = skip_range(ea.cmd, TRUE, NULL);
|
||||||
if (*ea.cmd == '*' && vim_strchr(p_cpo, CPO_STAR) == NULL)
|
|
||||||
ea.cmd = skipwhite(ea.cmd + 1);
|
|
||||||
|
|
||||||
#ifdef FEAT_EVAL
|
#ifdef FEAT_EVAL
|
||||||
if (vim9script && !starts_with_colon)
|
if (vim9script && !starts_with_colon)
|
||||||
@ -2683,7 +2681,7 @@ parse_command_modifiers(exarg_T *eap, char **errormsg, int skip_only)
|
|||||||
return FAIL;
|
return FAIL;
|
||||||
}
|
}
|
||||||
|
|
||||||
p = skip_range(eap->cmd, NULL);
|
p = skip_range(eap->cmd, TRUE, NULL);
|
||||||
switch (*p)
|
switch (*p)
|
||||||
{
|
{
|
||||||
// When adding an entry, also modify cmd_exists().
|
// When adding an entry, also modify cmd_exists().
|
||||||
@ -3534,7 +3532,8 @@ excmd_get_argt(cmdidx_T idx)
|
|||||||
char_u *
|
char_u *
|
||||||
skip_range(
|
skip_range(
|
||||||
char_u *cmd,
|
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;
|
unsigned delim;
|
||||||
|
|
||||||
@ -3569,6 +3568,10 @@ skip_range(
|
|||||||
while (*cmd == ':')
|
while (*cmd == ':')
|
||||||
cmd = skipwhite(cmd + 1);
|
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;
|
return cmd;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -187,8 +187,12 @@ set_search_match(pos_T *t)
|
|||||||
* May change the last search pattern.
|
* May change the last search pattern.
|
||||||
*/
|
*/
|
||||||
static int
|
static int
|
||||||
do_incsearch_highlighting(int firstc, int *search_delim, incsearch_state_T *is_state,
|
do_incsearch_highlighting(
|
||||||
int *skiplen, int *patlen)
|
int firstc,
|
||||||
|
int *search_delim,
|
||||||
|
incsearch_state_T *is_state,
|
||||||
|
int *skiplen,
|
||||||
|
int *patlen)
|
||||||
{
|
{
|
||||||
char_u *cmd;
|
char_u *cmd;
|
||||||
cmdmod_T save_cmdmod = cmdmod;
|
cmdmod_T save_cmdmod = cmdmod;
|
||||||
@ -230,7 +234,7 @@ do_incsearch_highlighting(int firstc, int *search_delim, incsearch_state_T *is_s
|
|||||||
parse_command_modifiers(&ea, &dummy, TRUE);
|
parse_command_modifiers(&ea, &dummy, TRUE);
|
||||||
cmdmod = save_cmdmod;
|
cmdmod = save_cmdmod;
|
||||||
|
|
||||||
cmd = skip_range(ea.cmd, NULL);
|
cmd = skip_range(ea.cmd, TRUE, NULL);
|
||||||
if (vim_strchr((char_u *)"sgvl", *cmd) == NULL)
|
if (vim_strchr((char_u *)"sgvl", *cmd) == NULL)
|
||||||
goto theend;
|
goto theend;
|
||||||
|
|
||||||
|
@ -16,7 +16,7 @@ int modifier_len(char_u *cmd);
|
|||||||
int cmd_exists(char_u *name);
|
int cmd_exists(char_u *name);
|
||||||
cmdidx_T excmd_get_cmdidx(char_u *cmd, int len);
|
cmdidx_T excmd_get_cmdidx(char_u *cmd, int len);
|
||||||
long excmd_get_argt(cmdidx_T idx);
|
long excmd_get_argt(cmdidx_T idx);
|
||||||
char_u *skip_range(char_u *cmd, int *ctx);
|
char_u *skip_range(char_u *cmd, int skip_star, int *ctx);
|
||||||
void ex_ni(exarg_T *eap);
|
void ex_ni(exarg_T *eap);
|
||||||
int expand_filename(exarg_T *eap, char_u **cmdlinep, char **errormsgp);
|
int expand_filename(exarg_T *eap, char_u **cmdlinep, char **errormsgp);
|
||||||
void separate_nextcmd(exarg_T *eap);
|
void separate_nextcmd(exarg_T *eap);
|
||||||
|
@ -330,6 +330,17 @@ def Test_put_command()
|
|||||||
bwipe!
|
bwipe!
|
||||||
enddef
|
enddef
|
||||||
|
|
||||||
|
def Test_command_star_range()
|
||||||
|
new
|
||||||
|
setline(1, ['xxx foo xxx', 'xxx bar xxx', 'xxx foo xx bar'])
|
||||||
|
setpos("'<", [0, 1, 0, 0])
|
||||||
|
setpos("'>", [0, 3, 0, 0])
|
||||||
|
:*s/\(foo\|bar\)/baz/g
|
||||||
|
getline(1, 3)->assert_equal(['xxx baz xxx', 'xxx baz xxx', 'xxx baz xx baz'])
|
||||||
|
|
||||||
|
bwipe!
|
||||||
|
enddef
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
" vim: ts=8 sw=2 sts=2 expandtab tw=80 fdm=marker
|
" vim: ts=8 sw=2 sts=2 expandtab tw=80 fdm=marker
|
||||||
|
@ -3150,7 +3150,7 @@ def_function(exarg_T *eap, char_u *name_arg)
|
|||||||
}
|
}
|
||||||
|
|
||||||
// Check for ":append", ":change", ":insert". Not for :def.
|
// Check for ":append", ":change", ":insert". Not for :def.
|
||||||
p = skip_range(p, NULL);
|
p = skip_range(p, FALSE, NULL);
|
||||||
if (eap->cmdidx != CMD_def
|
if (eap->cmdidx != CMD_def
|
||||||
&& ((p[0] == 'a' && (!ASCII_ISALPHA(p[1]) || p[1] == 'p'))
|
&& ((p[0] == 'a' && (!ASCII_ISALPHA(p[1]) || p[1] == 'p'))
|
||||||
|| (p[0] == 'c'
|
|| (p[0] == 'c'
|
||||||
|
@ -750,6 +750,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 */
|
||||||
|
/**/
|
||||||
|
1679,
|
||||||
/**/
|
/**/
|
||||||
1678,
|
1678,
|
||||||
/**/
|
/**/
|
||||||
|
@ -4276,7 +4276,7 @@ compile_return(char_u *arg, int set_return_type, cctx_T *cctx)
|
|||||||
}
|
}
|
||||||
if (need_type(stack_type, cctx->ctx_ufunc->uf_ret_type, -1,
|
if (need_type(stack_type, cctx->ctx_ufunc->uf_ret_type, -1,
|
||||||
cctx, FALSE) == FAIL)
|
cctx, FALSE) == FAIL)
|
||||||
return NULL;
|
return NULL;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
@ -6830,7 +6830,7 @@ compile_def_function(ufunc_T *ufunc, int set_return_type, cctx_T *outer_cctx)
|
|||||||
cmd = ea.cmd;
|
cmd = ea.cmd;
|
||||||
if (*cmd != '\'' || starts_with_colon)
|
if (*cmd != '\'' || starts_with_colon)
|
||||||
{
|
{
|
||||||
ea.cmd = skip_range(ea.cmd, NULL);
|
ea.cmd = skip_range(ea.cmd, TRUE, NULL);
|
||||||
if (ea.cmd > cmd)
|
if (ea.cmd > cmd)
|
||||||
{
|
{
|
||||||
if (!starts_with_colon)
|
if (!starts_with_colon)
|
||||||
|
Loading…
x
Reference in New Issue
Block a user