From 9081cd30a5ffa2d6cb41cbb5990c4a5d68cf9b6c Mon Sep 17 00:00:00 2001 From: Jan Edmund Lazo Date: Wed, 23 Jun 2021 23:10:11 -0400 Subject: vim-patch:8.2.3033: no error when using alpha delimiter with :global MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Problem: No error when using alpha delimiter with :global. Solution: Check the delimiter like with :substitute. (closes vim/vim#8415) https://github.com/vim/vim/commit/419a40ac9657e39646b2e0f3f71d7736b0c459d1 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) https://github.com/vim/vim/commit/c95e8d649045add4e77b423bc159dc0d845af559 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) https://github.com/vim/vim/commit/82c38fe508155c11a904e6111b5bfb6adde3fb9a 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) https://github.com/vim/vim/commit/ef7be8348fd830e409504a442f3f3ad0931cfbc3 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) https://github.com/vim/vim/commit/8ce3ca8961c5968a02de0a0b98f906695331f254 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) https://github.com/vim/vim/commit/cc6504098605f894b557109b618e88913a89914b 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) https://github.com/vim/vim/commit/d415d269130b233c0f198c75cc159bee721aa55c --- src/nvim/ex_cmds.c | 25 +++++++++++++++++-------- 1 file changed, 17 insertions(+), 8 deletions(-) (limited to 'src/nvim/ex_cmds.c') diff --git a/src/nvim/ex_cmds.c b/src/nvim/ex_cmds.c index 23383abc57..c399d47b7e 100644 --- a/src/nvim/ex_cmds.c +++ b/src/nvim/ex_cmds.c @@ -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) -- cgit