aboutsummaryrefslogtreecommitdiff
path: root/src/nvim/ex_cmds.c
diff options
context:
space:
mode:
authorzeertzjq <zeertzjq@outlook.com>2022-12-04 08:38:38 +0800
committerzeertzjq <zeertzjq@outlook.com>2022-12-04 10:07:04 +0800
commita91ba088abf7b21f640f671ad7f211c0957b4765 (patch)
treea1f206ecc559b64767e667945587b324c5ac3e12 /src/nvim/ex_cmds.c
parentfba0562723a1af143c9e9509920d03d8231b8bf7 (diff)
downloadrneovim-a91ba088abf7b21f640f671ad7f211c0957b4765.tar.gz
rneovim-a91ba088abf7b21f640f671ad7f211c0957b4765.tar.bz2
rneovim-a91ba088abf7b21f640f671ad7f211c0957b4765.zip
vim-patch:8.2.2182: Vim9: value of 'magic' is still relevant
Problem: Vim9: value of 'magic' is still relevant. Solution: Always behave like 'magic' is on in Vim9 script (closes vim/vim#7509) https://github.com/vim/vim/commit/f4e2099e39ed4d71aed0f9a9579455aed5ec6cc2 EX_NONWHITE_OK is N/A: only applies to Vim9 script. Co-authored-by: Bram Moolenaar <Bram@vim.org>
Diffstat (limited to 'src/nvim/ex_cmds.c')
-rw-r--r--src/nvim/ex_cmds.c14
1 files changed, 8 insertions, 6 deletions
diff --git a/src/nvim/ex_cmds.c b/src/nvim/ex_cmds.c
index 8ae7646268..33f7cde45e 100644
--- a/src/nvim/ex_cmds.c
+++ b/src/nvim/ex_cmds.c
@@ -3131,7 +3131,7 @@ static bool sub_joining_lines(exarg_T *eap, char *pat, const char *sub, const ch
if (save) {
if ((cmdmod.cmod_flags & CMOD_KEEPPATTERNS) == 0) {
- save_re_pat(RE_SUBST, pat, p_magic);
+ save_re_pat(RE_SUBST, pat, magic_isset());
}
// put pattern in history
add_to_history(HIST_SEARCH, pat, true, NUL);
@@ -3356,7 +3356,7 @@ static int do_sub(exarg_T *eap, proftime_T timeout, long cmdpreview_ns, handle_T
which_pat = RE_LAST; // use last used regexp
delimiter = (char_u)(*cmd++); // remember delimiter character
pat = cmd; // remember start of search pat
- cmd = skip_regexp_ex(cmd, delimiter, p_magic, &eap->arg, NULL);
+ cmd = skip_regexp_ex(cmd, delimiter, magic_isset(), &eap->arg, NULL);
if (cmd[0] == delimiter) { // end delimiter found
*cmd++ = NUL; // replace it with a NUL
has_second_delim = true;
@@ -3472,7 +3472,7 @@ static int do_sub(exarg_T *eap, proftime_T timeout, long cmdpreview_ns, handle_T
sub = xstrdup(sub);
sub_copy = sub;
} else {
- char *newsub = regtilde(sub, p_magic, cmdpreview);
+ char *newsub = regtilde(sub, magic_isset(), cmdpreview);
if (newsub != sub) {
// newsub was allocated, free it later.
sub_copy = newsub;
@@ -3895,7 +3895,8 @@ static int do_sub(exarg_T *eap, proftime_T timeout, long cmdpreview_ns, handle_T
sublen = vim_regsub_multi(&regmatch,
sub_firstlnum - regmatch.startpos[0].lnum,
(char_u *)sub, (char_u *)sub_firstline, 0,
- REGSUB_BACKSLASH | (p_magic ? REGSUB_MAGIC : 0));
+ REGSUB_BACKSLASH
+ | (magic_isset() ? REGSUB_MAGIC : 0));
textlock--;
// If getting the substitute string caused an error, don't do
@@ -3937,7 +3938,8 @@ static int do_sub(exarg_T *eap, proftime_T timeout, long cmdpreview_ns, handle_T
(void)vim_regsub_multi(&regmatch,
sub_firstlnum - regmatch.startpos[0].lnum,
(char_u *)sub, (char_u *)new_end, sublen,
- REGSUB_COPY | REGSUB_BACKSLASH | (p_magic ? REGSUB_MAGIC : 0));
+ REGSUB_COPY | REGSUB_BACKSLASH
+ | (magic_isset() ? REGSUB_MAGIC : 0));
textlock--;
sub_nsubs++;
did_sub = true;
@@ -4389,7 +4391,7 @@ void ex_global(exarg_T *eap)
delim = *cmd; // get the delimiter
cmd++; // skip delimiter if there is one
pat = cmd; // remember start of pattern
- cmd = skip_regexp_ex(cmd, delim, p_magic, &eap->arg, NULL);
+ cmd = skip_regexp_ex(cmd, delim, magic_isset(), &eap->arg, NULL);
if (cmd[0] == delim) { // end delimiter found
*cmd++ = NUL; // replace it with a NUL
}