Hi Bram,
Ah, I mistook the attached patch.
This patch is correct.
--
Best regards,
Hirohito Higashi (h_east)
--
--
You received this message from the "vim_dev" maillist.
Do not top-post! Type your reply below the text you are replying to.
For more information, visit http://www.vim.org/maillist.php
---
You received this message because you are subscribed to the Google Groups
"vim_dev" group.
To unsubscribe from this group and stop receiving emails from it, send an email
to [email protected].
For more options, visit https://groups.google.com/d/optout.
diff --git a/runtime/doc/options.txt b/runtime/doc/options.txt
index 2343d6342..9d5c3993f 100644
--- a/runtime/doc/options.txt
+++ b/runtime/doc/options.txt
@@ -4480,7 +4480,7 @@ A jump table for the options with a short description can be found at |Q_op|.
so far, matches. The matched string is highlighted. If the pattern
is invalid or not found, nothing is shown. The screen will be updated
often, this is only useful on fast terminals.
- Also applies to the `:s`, `:g` and `:v` commands.
+ Also applies to the `:s`, `:sno`, `:sm`, `:g` and `:v` commands.
Note that the match will be shown, but the cursor will return to its
original position when no match is found and when pressing <Esc>. You
still need to finish the search command with <Enter> to move the
diff --git a/src/ex_getln.c b/src/ex_getln.c
index ba6fe729c..bbf0a37ed 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;
}
}
diff --git a/src/testdir/test_search.vim b/src/testdir/test_search.vim
index a36b4fbcd..90a0a0e3b 100644
--- a/src/testdir/test_search.vim
+++ b/src/testdir/test_search.vim
@@ -384,6 +384,14 @@ func Test_search_cmdline3s()
undo
call feedkeys(":%substitute/the\<c-l>/xxx\<cr>", 'tx')
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()
endfunc