mirror of
https://github.com/neovim/neovim.git
synced 2025-02-25 18:55:25 -06:00
vim-patch:8.2.3033: no error when using alpha delimiter with :global
Problem: No error when using alpha delimiter with :global. Solution: Check the delimiter like with :substitute. (closes vim/vim#8415)419a40ac96
N/A patches for version.c: vim-patch:8.1.2391: cannot build when __QNXNTO__ is defined Problem: Cannot build when __QNXNTO__ is defined. (Ian Wayne Larson) Solution: Move the check for "qansi". (Ken Takata, closes vim/vim#5317)c95e8d6490
vim-patch:8.2.2294: VMS: a few remaining problems Problem: VMS: a few remaining problems. Solution: Add VMS specific changes. Add Lua support. (Zoltan Arpadffy)82c38fe508
vim-patch:8.2.3034: installing packages on github CI sometimes fails Problem: Installing packages on github CI sometimes fails. Solution: Update package information first. (Christian Brabandt, closes vim/vim#8432)ef7be8348f
vim-patch:8.2.3037: configure reports libcanberra when checking for libsodium Problem: Configure reports libcanberra when checking for libsodium. Solution: Adjust the message. (Ozaki Kiichi, closes vim/vim#8435)8ce3ca8961
vim-patch:8.2.3038: Amiga built-in version string doesn't include build date Problem: Amiga built-in version string doesn't include build date. Solution: Add the build date if available. (Ola Söder, closes vim/vim#8437)cc65040986
vim-patch:8.2.3043: Amiga: cannot get the shell size on MorphOS and AROS Problem: Amiga: cannot get the shell size on MorphOS and AROS. Solution: Use control sequences. (Ola Söder, closes vim/vim#8438)d415d26913
This commit is contained in:
parent
cd4b649136
commit
9081cd30a5
@ -3344,6 +3344,15 @@ static char_u *sub_parse_flags(char_u *cmd, subflags_T *subflags,
|
||||
return cmd;
|
||||
}
|
||||
|
||||
static int check_regexp_delim(int c)
|
||||
FUNC_ATTR_PURE FUNC_ATTR_WARN_UNUSED_RESULT
|
||||
{
|
||||
if (isalpha(c)) {
|
||||
EMSG(_("E146: Regular expressions can't be delimited by letters"));
|
||||
return FAIL;
|
||||
}
|
||||
return OK;
|
||||
}
|
||||
|
||||
/// Perform a substitution from line eap->line1 to line eap->line2 using the
|
||||
/// command pointed to by eap->arg which should be of the form:
|
||||
@ -3408,16 +3417,14 @@ static buf_T *do_sub(exarg_T *eap, proftime_T timeout,
|
||||
/* new pattern and substitution */
|
||||
if (eap->cmd[0] == 's' && *cmd != NUL && !ascii_iswhite(*cmd)
|
||||
&& vim_strchr((char_u *)"0123456789cegriIp|\"", *cmd) == NULL) {
|
||||
/* don't accept alphanumeric for separator */
|
||||
if (isalpha(*cmd)) {
|
||||
EMSG(_("E146: Regular expressions can't be delimited by letters"));
|
||||
// don't accept alphanumeric for separator
|
||||
if (check_regexp_delim(*cmd) == FAIL) {
|
||||
return NULL;
|
||||
}
|
||||
/*
|
||||
* undocumented vi feature:
|
||||
* "\/sub/" and "\?sub?" use last used search pattern (almost like
|
||||
* //sub/r). "\&sub&" use last substitute pattern (like //sub/).
|
||||
*/
|
||||
|
||||
// undocumented vi feature:
|
||||
// "\/sub/" and "\?sub?" use last used search pattern (almost like
|
||||
// //sub/r). "\&sub&" use last substitute pattern (like //sub/).
|
||||
if (*cmd == '\\') {
|
||||
++cmd;
|
||||
if (vim_strchr((char_u *)"/?&", *cmd) == NULL) {
|
||||
@ -4455,6 +4462,8 @@ void ex_global(exarg_T *eap)
|
||||
} else if (*cmd == NUL) {
|
||||
EMSG(_("E148: Regular expression missing from global"));
|
||||
return;
|
||||
} else if (check_regexp_delim(*cmd) == FAIL) {
|
||||
return;
|
||||
} else {
|
||||
delim = *cmd; /* get the delimiter */
|
||||
if (delim)
|
||||
|
@ -36,4 +36,8 @@ func Test_global_error()
|
||||
call assert_fails('g/\(/y', 'E476:')
|
||||
endfunc
|
||||
|
||||
func Test_wrong_delimiter()
|
||||
call assert_fails('g x^bxd', 'E146:')
|
||||
endfunc
|
||||
|
||||
" vim: shiftwidth=2 sts=2 expandtab
|
||||
|
Loading…
Reference in New Issue
Block a user