diff options
author | Bram Moolenaar <Bram@vim.org> | 2018-08-14 21:32:21 +0200 |
---|---|---|
committer | Bram Moolenaar <Bram@vim.org> | 2018-08-14 21:32:21 +0200 |
commit | 167ae42685dcd430800c51ac7339f7f0938a3e70 (patch) | |
tree | 2a3ca046561dfbf24aae9410a601de37dffeddf6 /src/ex_getln.c | |
parent | d7cc16357083c4fc4271e25fb36c4fbaee99e0f1 (diff) |
patch 8.1.0286: 'incsearch' does not apply to :smagic and :snomagicv8.1.0286
Problem: 'incsearch' does not apply to :smagic and :snomagic.
Solution: Add support. (Hirohito Higashi)
Diffstat (limited to 'src/ex_getln.c')
-rw-r--r-- | src/ex_getln.c | 10 |
1 files changed, 10 insertions, 0 deletions
diff --git a/src/ex_getln.c b/src/ex_getln.c index d200eab78a..4af3904409 100644 --- a/src/ex_getln.c +++ b/src/ex_getln.c @@ -231,6 +231,7 @@ typedef struct { pos_T match_end; int did_incsearch; int incsearch_postponed; + int magic_save; } incsearch_state_T; static void @@ -239,6 +240,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; CLEAR_POS(&is_state->match_end); is_state->save_cursor = curwin->w_cursor; // may be restored later is_state->search_start = curwin->w_cursor; @@ -308,9 +310,16 @@ do_incsearch_highlighting(int firstc, incsearch_state_T *is_state, ; if (*skipwhite(p) != NUL && (STRNCMP(cmd, "substitute", p - cmd) == 0 + || STRNCMP(cmd, "smagic", p - cmd) == 0 + || STRNCMP(cmd, "snomagic", MAX(p - cmd, 3)) == 0 || STRNCMP(cmd, "global", p - cmd) == 0 || STRNCMP(cmd, "vglobal", p - cmd) == 0)) { + if (*cmd == 's' && cmd[1] == 'm') + p_magic = TRUE; + else if (*cmd == 's' && cmd[1] == 'n') + p_magic = FALSE; + // Check for "global!/". if (*cmd == 'g' && *p == '!') { @@ -392,6 +401,7 @@ finish_incsearch_highlighting( update_screen(SOME_VALID); else redraw_all_later(SOME_VALID); + p_magic = is_state->magic_save; } } |