mirror of
https://github.com/neovim/neovim.git
synced 2025-09-22 11:18:19 +00:00
vim-patch:8.1.1742: still some match functions in evalfunc.c
Problem: Still some match functions in evalfunc.c.
Solution: Move them to highlight.c.
7dfb016d25
This commit is contained in:
@@ -9541,70 +9541,6 @@ static void ex_nohlsearch(exarg_T *eap)
|
||||
redraw_all_later(SOME_VALID);
|
||||
}
|
||||
|
||||
/// ":[N]match {group} {pattern}"
|
||||
/// Sets nextcmd to the start of the next command, if any. Also called when
|
||||
/// skipping commands to find the next command.
|
||||
static void ex_match(exarg_T *eap)
|
||||
{
|
||||
char_u *p;
|
||||
char_u *g = NULL;
|
||||
char_u *end;
|
||||
int c;
|
||||
int id;
|
||||
|
||||
if (eap->line2 <= 3) {
|
||||
id = eap->line2;
|
||||
} else {
|
||||
emsg(e_invcmd);
|
||||
return;
|
||||
}
|
||||
|
||||
// First clear any old pattern.
|
||||
if (!eap->skip) {
|
||||
match_delete(curwin, id, false);
|
||||
}
|
||||
|
||||
if (ends_excmd(*eap->arg)) {
|
||||
end = eap->arg;
|
||||
} else if ((STRNICMP(eap->arg, "none", 4) == 0
|
||||
&& (ascii_iswhite(eap->arg[4]) || ends_excmd(eap->arg[4])))) {
|
||||
end = eap->arg + 4;
|
||||
} else {
|
||||
p = skiptowhite(eap->arg);
|
||||
if (!eap->skip) {
|
||||
g = vim_strnsave(eap->arg, p - eap->arg);
|
||||
}
|
||||
p = skipwhite(p);
|
||||
if (*p == NUL) {
|
||||
// There must be two arguments.
|
||||
xfree(g);
|
||||
semsg(_(e_invarg2), eap->arg);
|
||||
return;
|
||||
}
|
||||
end = skip_regexp(p + 1, *p, true, NULL);
|
||||
if (!eap->skip) {
|
||||
if (*end != NUL && !ends_excmd(*skipwhite(end + 1))) {
|
||||
xfree(g);
|
||||
eap->errmsg = e_trailing;
|
||||
return;
|
||||
}
|
||||
if (*end != *p) {
|
||||
xfree(g);
|
||||
semsg(_(e_invarg2), p);
|
||||
return;
|
||||
}
|
||||
|
||||
c = *end;
|
||||
*end = NUL;
|
||||
match_add(curwin, (const char *)g, (const char *)p + 1, 10, id,
|
||||
NULL, NULL);
|
||||
xfree(g);
|
||||
*end = c;
|
||||
}
|
||||
}
|
||||
eap->nextcmd = find_nextcmd(end);
|
||||
}
|
||||
|
||||
static void ex_fold(exarg_T *eap)
|
||||
{
|
||||
if (foldManualAllowed(true)) {
|
||||
|
Reference in New Issue
Block a user