summaryrefslogtreecommitdiff
path: root/src/ex_cmds.c
diff options
context:
space:
mode:
authorBram Moolenaar <Bram@vim.org>2020-12-21 19:59:08 +0100
committerBram Moolenaar <Bram@vim.org>2020-12-21 19:59:08 +0100
commitf4e2099e39ed4d71aed0f9a9579455aed5ec6cc2 (patch)
tree40a384257e29f443c46bbaa19fb88a8eb5441b05 /src/ex_cmds.c
parenta3d10a508c404a32485adc86284725e0bdc5b602 (diff)
downloadvim-git-f4e2099e39ed4d71aed0f9a9579455aed5ec6cc2.tar.gz
patch 8.2.2182: Vim9: value of 'magic' is still relevantv8.2.2182
Problem: Vim9: value of 'magic' is still relevant. Solution: Always behave like 'magic' is on in Vim9 script (closes #7509)
Diffstat (limited to 'src/ex_cmds.c')
-rw-r--r--src/ex_cmds.c13
1 files changed, 7 insertions, 6 deletions
diff --git a/src/ex_cmds.c b/src/ex_cmds.c
index e7575f950..01f14cd58 100644
--- a/src/ex_cmds.c
+++ b/src/ex_cmds.c
@@ -3671,7 +3671,8 @@ ex_substitute(exarg_T *eap)
which_pat = RE_LAST; // use last used regexp
delimiter = *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
}
@@ -3763,7 +3764,7 @@ ex_substitute(exarg_T *eap)
}
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);
@@ -3897,7 +3898,7 @@ ex_substitute(exarg_T *eap)
* But don't do it when it starts with "\=", then it's an expression.
*/
if (!(sub[0] == '\\' && sub[1] == '='))
- sub = regtilde(sub, p_magic);
+ sub = regtilde(sub, magic_isset());
/*
* Check for a match on each line.
@@ -4309,7 +4310,7 @@ ex_substitute(exarg_T *eap)
// get length of substitution part
sublen = vim_regsub_multi(&regmatch,
sub_firstlnum - regmatch.startpos[0].lnum,
- sub, sub_firstline, FALSE, p_magic, TRUE);
+ sub, sub_firstline, FALSE, magic_isset(), TRUE);
#ifdef FEAT_EVAL
// If getting the substitute string caused an error, don't do
// the replacement.
@@ -4413,7 +4414,7 @@ ex_substitute(exarg_T *eap)
(void)vim_regsub_multi(&regmatch,
sub_firstlnum - regmatch.startpos[0].lnum,
- sub, new_end, TRUE, p_magic, TRUE);
+ sub, new_end, TRUE, magic_isset(), TRUE);
sub_nsubs++;
did_sub = TRUE;
@@ -4846,7 +4847,7 @@ ex_global(exarg_T *eap)
if (delim)
++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
}