diff options
author | Bram Moolenaar <Bram@vim.org> | 2020-12-21 19:59:08 +0100 |
---|---|---|
committer | Bram Moolenaar <Bram@vim.org> | 2020-12-21 19:59:08 +0100 |
commit | f4e2099e39ed4d71aed0f9a9579455aed5ec6cc2 (patch) | |
tree | 40a384257e29f443c46bbaa19fb88a8eb5441b05 /src/ex_getln.c | |
parent | a3d10a508c404a32485adc86284725e0bdc5b602 (diff) | |
download | vim-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_getln.c')
-rw-r--r-- | src/ex_getln.c | 14 |
1 files changed, 7 insertions, 7 deletions
diff --git a/src/ex_getln.c b/src/ex_getln.c index 54924c188..04b10ead4 100644 --- a/src/ex_getln.c +++ b/src/ex_getln.c @@ -149,7 +149,7 @@ typedef struct { pos_T match_end; int did_incsearch; int incsearch_postponed; - int magic_save; + magic_T magic_overruled_save; } incsearch_state_T; static void @@ -159,7 +159,7 @@ init_incsearch_state(incsearch_state_T *is_state) is_state->match_start = curwin->w_cursor; is_state->did_incsearch = FALSE; is_state->incsearch_postponed = FALSE; - is_state->magic_save = p_magic; + is_state->magic_overruled_save = magic_overruled; CLEAR_POS(&is_state->match_end); is_state->save_cursor = curwin->w_cursor; // may be restored later is_state->search_start = curwin->w_cursor; @@ -252,9 +252,9 @@ do_incsearch_highlighting( || STRNCMP(cmd, "vglobal", p - cmd) == 0) { if (*cmd == 's' && cmd[1] == 'm') - p_magic = TRUE; + magic_overruled = MAGIC_ON; else if (*cmd == 's' && cmd[1] == 'n') - p_magic = FALSE; + magic_overruled = MAGIC_OFF; } else if (STRNCMP(cmd, "sort", MAX(p - cmd, 3)) == 0) { @@ -288,7 +288,7 @@ do_incsearch_highlighting( p = skipwhite(p); delim = (delim_optional && vim_isIDc(*p)) ? ' ' : *p++; *search_delim = delim; - end = skip_regexp(p, delim, p_magic); + end = skip_regexp(p, delim, magic_isset()); use_last_pat = end == p && *end == delim; @@ -372,7 +372,7 @@ finish_incsearch_highlighting( search_first_line = 0; search_last_line = MAXLNUM; - p_magic = is_state->magic_save; + magic_overruled = is_state->magic_overruled_save; validate_cursor(); // needed for TAB redraw_all_later(SOME_VALID); @@ -713,7 +713,7 @@ may_add_char_to_search(int firstc, int *c, incsearch_state_T *is_state) if (p_ic && p_scs && !pat_has_uppercase(ccline.cmdbuff + skiplen)) *c = MB_TOLOWER(*c); if (*c == search_delim || vim_strchr((char_u *)( - p_magic ? "\\~^$.*[" : "\\^$"), *c) != NULL) + magic_isset() ? "\\~^$.*[" : "\\^$"), *c) != NULL) { // put a backslash before special characters stuffcharReadbuff(*c); |