mirror of
https://github.com/vim/vim.git
synced 2025-09-25 03:54:15 -04:00
patch 8.1.0286: 'incsearch' does not apply to :smagic and :snomagic
Problem: 'incsearch' does not apply to :smagic and :snomagic. Solution: Add support. (Hirohito Higashi)
This commit is contained in:
@@ -231,6 +231,7 @@ typedef struct {
|
|||||||
pos_T match_end;
|
pos_T match_end;
|
||||||
int did_incsearch;
|
int did_incsearch;
|
||||||
int incsearch_postponed;
|
int incsearch_postponed;
|
||||||
|
int magic_save;
|
||||||
} incsearch_state_T;
|
} incsearch_state_T;
|
||||||
|
|
||||||
static void
|
static void
|
||||||
@@ -239,6 +240,7 @@ init_incsearch_state(incsearch_state_T *is_state)
|
|||||||
is_state->match_start = curwin->w_cursor;
|
is_state->match_start = curwin->w_cursor;
|
||||||
is_state->did_incsearch = FALSE;
|
is_state->did_incsearch = FALSE;
|
||||||
is_state->incsearch_postponed = FALSE;
|
is_state->incsearch_postponed = FALSE;
|
||||||
|
is_state->magic_save = p_magic;
|
||||||
CLEAR_POS(&is_state->match_end);
|
CLEAR_POS(&is_state->match_end);
|
||||||
is_state->save_cursor = curwin->w_cursor; // may be restored later
|
is_state->save_cursor = curwin->w_cursor; // may be restored later
|
||||||
is_state->search_start = curwin->w_cursor;
|
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
|
if (*skipwhite(p) != NUL
|
||||||
&& (STRNCMP(cmd, "substitute", p - cmd) == 0
|
&& (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, "global", p - cmd) == 0
|
||||||
|| STRNCMP(cmd, "vglobal", 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!/".
|
// Check for "global!/".
|
||||||
if (*cmd == 'g' && *p == '!')
|
if (*cmd == 'g' && *p == '!')
|
||||||
{
|
{
|
||||||
@@ -392,6 +401,7 @@ finish_incsearch_highlighting(
|
|||||||
update_screen(SOME_VALID);
|
update_screen(SOME_VALID);
|
||||||
else
|
else
|
||||||
redraw_all_later(SOME_VALID);
|
redraw_all_later(SOME_VALID);
|
||||||
|
p_magic = is_state->magic_save;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@@ -384,6 +384,14 @@ func Test_search_cmdline3s()
|
|||||||
undo
|
undo
|
||||||
call feedkeys(":%substitute/the\<c-l>/xxx\<cr>", 'tx')
|
call feedkeys(":%substitute/the\<c-l>/xxx\<cr>", 'tx')
|
||||||
call assert_equal(' 2 xxxe', getline('.'))
|
call assert_equal(' 2 xxxe', getline('.'))
|
||||||
|
undo
|
||||||
|
call feedkeys(":%smagic/the.e/xxx\<cr>", 'tx')
|
||||||
|
call assert_equal(' 2 xxx', getline('.'))
|
||||||
|
undo
|
||||||
|
call assert_fails(":%snomagic/the.e/xxx\<cr>", 'E486')
|
||||||
|
"
|
||||||
|
call feedkeys(":%snomagic/the\\.e/xxx\<cr>", 'tx')
|
||||||
|
call assert_equal(' 2 xxx', getline('.'))
|
||||||
|
|
||||||
call Incsearch_cleanup()
|
call Incsearch_cleanup()
|
||||||
endfunc
|
endfunc
|
||||||
|
@@ -794,6 +794,8 @@ static char *(features[]) =
|
|||||||
|
|
||||||
static int included_patches[] =
|
static int included_patches[] =
|
||||||
{ /* Add new patch number below this line */
|
{ /* Add new patch number below this line */
|
||||||
|
/**/
|
||||||
|
286,
|
||||||
/**/
|
/**/
|
||||||
285,
|
285,
|
||||||
/**/
|
/**/
|
||||||
|
Reference in New Issue
Block a user