comparison src/tag.c @ 23272:a84e7abb0c92 v8.2.2182

patch 8.2.2182: Vim9: value of 'magic' is still relevant Commit: https://github.com/vim/vim/commit/f4e2099e39ed4d71aed0f9a9579455aed5ec6cc2 Author: Bram Moolenaar <Bram@vim.org> Date: Mon Dec 21 19:59:08 2020 +0100 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 https://github.com/vim/vim/issues/7509)
author Bram Moolenaar <Bram@vim.org>
date Mon, 21 Dec 2020 20:00:06 +0100
parents e82579016863
children bb29b09902d5
comparison
equal deleted inserted replaced
23271:50ebb4982f37 23272:a84e7abb0c92
1269 if (pats->head == pats->pat) 1269 if (pats->head == pats->pat)
1270 pats->headlen = 0; 1270 pats->headlen = 0;
1271 else 1271 else
1272 for (pats->headlen = 0; pats->head[pats->headlen] != NUL; 1272 for (pats->headlen = 0; pats->head[pats->headlen] != NUL;
1273 ++pats->headlen) 1273 ++pats->headlen)
1274 if (vim_strchr((char_u *)(p_magic ? ".[~*\\$" : "\\$"), 1274 if (vim_strchr((char_u *)(magic_isset() ? ".[~*\\$" : "\\$"),
1275 pats->head[pats->headlen]) != NULL) 1275 pats->head[pats->headlen]) != NULL)
1276 break; 1276 break;
1277 if (p_tl != 0 && pats->headlen > p_tl) // adjust for 'taglength' 1277 if (p_tl != 0 && pats->headlen > p_tl) // adjust for 'taglength'
1278 pats->headlen = p_tl; 1278 pats->headlen = p_tl;
1279 } 1279 }
1280 1280
1281 if (has_re) 1281 if (has_re)
1282 pats->regmatch.regprog = vim_regcomp(pats->pat, p_magic ? RE_MAGIC : 0); 1282 pats->regmatch.regprog = vim_regcomp(pats->pat,
1283 magic_isset() ? RE_MAGIC : 0);
1283 else 1284 else
1284 pats->regmatch.regprog = NULL; 1285 pats->regmatch.regprog = NULL;
1285 } 1286 }
1286 1287
1287 #ifdef FEAT_EVAL 1288 #ifdef FEAT_EVAL
3309 char_u *lbuf_arg, // line from the tags file for this tag 3310 char_u *lbuf_arg, // line from the tags file for this tag
3310 int forceit, // :ta with ! 3311 int forceit, // :ta with !
3311 int keep_help) // keep help flag (FALSE for cscope) 3312 int keep_help) // keep help flag (FALSE for cscope)
3312 { 3313 {
3313 int save_secure; 3314 int save_secure;
3314 int save_magic; 3315 int save_magic_overruled;
3315 int save_p_ws, save_p_scs, save_p_ic; 3316 int save_p_ws, save_p_scs, save_p_ic;
3316 linenr_T save_lnum; 3317 linenr_T save_lnum;
3317 char_u *str; 3318 char_u *str;
3318 char_u *pbuf; // search pattern buffer 3319 char_u *pbuf; // search pattern buffer
3319 char_u *pbuf_end; 3320 char_u *pbuf_end;
3501 save_secure = secure; 3502 save_secure = secure;
3502 secure = 1; 3503 secure = 1;
3503 #ifdef HAVE_SANDBOX 3504 #ifdef HAVE_SANDBOX
3504 ++sandbox; 3505 ++sandbox;
3505 #endif 3506 #endif
3506 save_magic = p_magic; 3507 save_magic_overruled = magic_overruled;
3507 p_magic = FALSE; // always execute with 'nomagic' 3508 magic_overruled = MAGIC_OFF; // always execute with 'nomagic'
3508 #ifdef FEAT_SEARCH_EXTRA 3509 #ifdef FEAT_SEARCH_EXTRA
3509 // Save value of no_hlsearch, jumping to a tag is not a real search 3510 // Save value of no_hlsearch, jumping to a tag is not a real search
3510 save_no_hlsearch = no_hlsearch; 3511 save_no_hlsearch = no_hlsearch;
3511 #endif 3512 #endif
3512 3513
3624 * the error message can be seen. 3625 * the error message can be seen.
3625 */ 3626 */
3626 if (secure == 2) 3627 if (secure == 2)
3627 wait_return(TRUE); 3628 wait_return(TRUE);
3628 secure = save_secure; 3629 secure = save_secure;
3629 p_magic = save_magic; 3630 magic_overruled = save_magic_overruled;
3630 #ifdef HAVE_SANDBOX 3631 #ifdef HAVE_SANDBOX
3631 --sandbox; 3632 --sandbox;
3632 #endif 3633 #endif
3633 #ifdef FEAT_SEARCH_EXTRA 3634 #ifdef FEAT_SEARCH_EXTRA
3634 // restore no_hlsearch when keeping the old search pattern 3635 // restore no_hlsearch when keeping the old search pattern