mirror of
https://github.com/neovim/neovim.git
synced 2025-10-05 01:16:31 +00:00
vim-patch:8.2.0612: Vim9: no check for space before #comment
Problem: Vim9: no check for space before #comment.
Solution: Add space checks.
2c5ed4e330
Omit ends_excmd2(): the same as ends_excmd() in legacy Vim script.
Co-authored-by: Bram Moolenaar <Bram@vim.org>
This commit is contained in:
@@ -504,9 +504,8 @@ void ex_sort(exarg_T *eap)
|
|||||||
eap->nextcmd = check_nextcmd(p);
|
eap->nextcmd = check_nextcmd(p);
|
||||||
break;
|
break;
|
||||||
} else if (!ASCII_ISALPHA(*p) && regmatch.regprog == NULL) {
|
} else if (!ASCII_ISALPHA(*p) && regmatch.regprog == NULL) {
|
||||||
s = skip_regexp(p + 1, *p, true);
|
s = skip_regexp_err(p + 1, *p, true);
|
||||||
if (*s != *p) {
|
if (s == NULL) {
|
||||||
emsg(_(e_invalpat));
|
|
||||||
goto sortend;
|
goto sortend;
|
||||||
}
|
}
|
||||||
*s = NUL;
|
*s = NUL;
|
||||||
|
@@ -900,12 +900,12 @@ void ex_else(exarg_T *eap)
|
|||||||
if (eap->cmdidx == CMD_elseif) {
|
if (eap->cmdidx == CMD_elseif) {
|
||||||
bool error;
|
bool error;
|
||||||
result = eval_to_bool(eap->arg, &error, &eap->nextcmd, skip);
|
result = eval_to_bool(eap->arg, &error, &eap->nextcmd, skip);
|
||||||
|
|
||||||
// When throwing error exceptions, we want to throw always the first
|
// When throwing error exceptions, we want to throw always the first
|
||||||
// of several errors in a row. This is what actually happens when
|
// of several errors in a row. This is what actually happens when
|
||||||
// a conditional error was detected above and there is another failure
|
// a conditional error was detected above and there is another failure
|
||||||
// when parsing the expression. Since the skip flag is set in this
|
// when parsing the expression. Since the skip flag is set in this
|
||||||
// case, the parsing error will be ignored by emsg().
|
// case, the parsing error will be ignored by emsg().
|
||||||
|
|
||||||
if (!skip && !error) {
|
if (!skip && !error) {
|
||||||
if (result) {
|
if (result) {
|
||||||
cstack->cs_flags[cstack->cs_idx] = CSF_ACTIVE | CSF_TRUE;
|
cstack->cs_flags[cstack->cs_idx] = CSF_ACTIVE | CSF_TRUE;
|
||||||
@@ -1296,7 +1296,10 @@ void ex_catch(exarg_T *eap)
|
|||||||
eap->nextcmd = find_nextcmd(eap->arg);
|
eap->nextcmd = find_nextcmd(eap->arg);
|
||||||
} else {
|
} else {
|
||||||
pat = eap->arg + 1;
|
pat = eap->arg + 1;
|
||||||
end = skip_regexp(pat, *eap->arg, true);
|
end = skip_regexp_err(pat, *eap->arg, true);
|
||||||
|
if (end == NULL) {
|
||||||
|
give_up = true;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
if (!give_up) {
|
if (!give_up) {
|
||||||
|
@@ -851,7 +851,7 @@ void do_highlight(const char *line, const bool forceit, const bool init)
|
|||||||
bool did_highlight_changed = false;
|
bool did_highlight_changed = false;
|
||||||
|
|
||||||
// If no argument, list current highlighting.
|
// If no argument, list current highlighting.
|
||||||
if (ends_excmd((uint8_t)(*line))) {
|
if (!init && ends_excmd((uint8_t)(*line))) {
|
||||||
for (int i = 1; i <= highlight_ga.ga_len && !got_int; i++) {
|
for (int i = 1; i <= highlight_ga.ga_len && !got_int; i++) {
|
||||||
// TODO(brammool): only call when the group has attributes set
|
// TODO(brammool): only call when the group has attributes set
|
||||||
highlight_list_one(i);
|
highlight_list_one(i);
|
||||||
|
@@ -481,12 +481,25 @@ static char_u *skip_anyof(char *p)
|
|||||||
}
|
}
|
||||||
|
|
||||||
/// Skip past regular expression.
|
/// Skip past regular expression.
|
||||||
/// Stop at end of "startp" or where "dirc" is found ('/', '?', etc).
|
/// Stop at end of "startp" or where "delim" is found ('/', '?', etc).
|
||||||
/// Take care of characters with a backslash in front of it.
|
/// Take care of characters with a backslash in front of it.
|
||||||
/// Skip strings inside [ and ].
|
/// Skip strings inside [ and ].
|
||||||
char *skip_regexp(char *startp, int dirc, int magic)
|
char *skip_regexp(char *startp, int delim, int magic)
|
||||||
{
|
{
|
||||||
return skip_regexp_ex(startp, dirc, magic, NULL, NULL);
|
return skip_regexp_ex(startp, delim, magic, NULL, NULL);
|
||||||
|
}
|
||||||
|
|
||||||
|
/// Call skip_regexp() and when the delimiter does not match give an error and
|
||||||
|
/// return NULL.
|
||||||
|
char *skip_regexp_err(char *startp, int delim, int magic)
|
||||||
|
{
|
||||||
|
char *p = skip_regexp(startp, delim, magic);
|
||||||
|
|
||||||
|
if (*p != delim) {
|
||||||
|
semsg(_("E654: missing delimiter after search pattern: %s"), startp);
|
||||||
|
return NULL;
|
||||||
|
}
|
||||||
|
return p;
|
||||||
}
|
}
|
||||||
|
|
||||||
/// skip_regexp() with extra arguments:
|
/// skip_regexp() with extra arguments:
|
||||||
|
@@ -1360,7 +1360,7 @@ func Test_sort_cmd()
|
|||||||
call setline(1, ['line1', 'line2'])
|
call setline(1, ['line1', 'line2'])
|
||||||
call assert_fails('sort no', 'E474:')
|
call assert_fails('sort no', 'E474:')
|
||||||
call assert_fails('sort c', 'E475:')
|
call assert_fails('sort c', 'E475:')
|
||||||
call assert_fails('sort #pat%', 'E682:')
|
call assert_fails('sort #pat%', 'E654:')
|
||||||
|
|
||||||
enew!
|
enew!
|
||||||
endfunc
|
endfunc
|
||||||
|
Reference in New Issue
Block a user