diff options
author | Jan Edmund Lazo <jan.lazo@mail.utoronto.ca> | 2021-06-23 23:10:11 -0400 |
---|---|---|
committer | Jan Edmund Lazo <jan.lazo@mail.utoronto.ca> | 2021-06-23 23:27:01 -0400 |
commit | 9081cd30a5ffa2d6cb41cbb5990c4a5d68cf9b6c (patch) | |
tree | bb9fac7c1d190857a1456742b5703f5cf9444627 /src | |
parent | cd4b649136b9c4529a6f2f9043ad0c7335126d71 (diff) | |
download | rneovim-9081cd30a5ffa2d6cb41cbb5990c4a5d68cf9b6c.tar.gz rneovim-9081cd30a5ffa2d6cb41cbb5990c4a5d68cf9b6c.tar.bz2 rneovim-9081cd30a5ffa2d6cb41cbb5990c4a5d68cf9b6c.zip |
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)
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
Diffstat (limited to 'src')
-rw-r--r-- | src/nvim/ex_cmds.c | 25 | ||||
-rw-r--r-- | src/nvim/testdir/test_global.vim | 4 |
2 files changed, 21 insertions, 8 deletions
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) diff --git a/src/nvim/testdir/test_global.vim b/src/nvim/testdir/test_global.vim index 2de2c412de..8edc9c2608 100644 --- a/src/nvim/testdir/test_global.vim +++ b/src/nvim/testdir/test_global.vim @@ -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 |