1
0
forked from aniani/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 #7509)
This commit is contained in:
Bram Moolenaar
2020-12-21 19:59:08 +01:00
parent a3d10a508c
commit f4e2099e39
17 changed files with 98 additions and 42 deletions

View File

@@ -1271,7 +1271,7 @@ prepare_pats(pat_T *pats, int has_re)
else
for (pats->headlen = 0; pats->head[pats->headlen] != NUL;
++pats->headlen)
if (vim_strchr((char_u *)(p_magic ? ".[~*\\$" : "\\$"),
if (vim_strchr((char_u *)(magic_isset() ? ".[~*\\$" : "\\$"),
pats->head[pats->headlen]) != NULL)
break;
if (p_tl != 0 && pats->headlen > p_tl) // adjust for 'taglength'
@@ -1279,7 +1279,8 @@ prepare_pats(pat_T *pats, int has_re)
}
if (has_re)
pats->regmatch.regprog = vim_regcomp(pats->pat, p_magic ? RE_MAGIC : 0);
pats->regmatch.regprog = vim_regcomp(pats->pat,
magic_isset() ? RE_MAGIC : 0);
else
pats->regmatch.regprog = NULL;
}
@@ -3311,7 +3312,7 @@ jumpto_tag(
int keep_help) // keep help flag (FALSE for cscope)
{
int save_secure;
int save_magic;
int save_magic_overruled;
int save_p_ws, save_p_scs, save_p_ic;
linenr_T save_lnum;
char_u *str;
@@ -3503,8 +3504,8 @@ jumpto_tag(
#ifdef HAVE_SANDBOX
++sandbox;
#endif
save_magic = p_magic;
p_magic = FALSE; // always execute with 'nomagic'
save_magic_overruled = magic_overruled;
magic_overruled = MAGIC_OFF; // always execute with 'nomagic'
#ifdef FEAT_SEARCH_EXTRA
// Save value of no_hlsearch, jumping to a tag is not a real search
save_no_hlsearch = no_hlsearch;
@@ -3626,7 +3627,7 @@ jumpto_tag(
if (secure == 2)
wait_return(TRUE);
secure = save_secure;
p_magic = save_magic;
magic_overruled = save_magic_overruled;
#ifdef HAVE_SANDBOX
--sandbox;
#endif