diff options
Diffstat (limited to 'src/ex_getln.c')
-rw-r--r-- | src/ex_getln.c | 16 |
1 files changed, 14 insertions, 2 deletions
diff --git a/src/ex_getln.c b/src/ex_getln.c index ba6a40359..717a01224 100644 --- a/src/ex_getln.c +++ b/src/ex_getln.c @@ -1715,8 +1715,9 @@ getcmdline( if (p_is && !cmd_silent && (firstc == '/' || firstc == '?')) { pos_T t; - int search_flags = SEARCH_KEEP + SEARCH_NOOF; + int search_flags = SEARCH_NOOF; + save_last_search_pattern(); cursor_off(); out_flush(); if (c == Ctrl_G) @@ -1726,6 +1727,8 @@ getcmdline( } else t = match_start; + if (!p_hls) + search_flags += SEARCH_KEEP; ++emsg_off; i = searchit(curwin, curbuf, &t, c == Ctrl_G ? FORWARD : BACKWARD, @@ -1777,6 +1780,7 @@ getcmdline( # endif old_botline = curwin->w_botline; update_screen(NOT_VALID); + restore_last_search_pattern(); redrawcmdline(); } else @@ -1934,12 +1938,17 @@ cmdline_changed: } incsearch_postponed = FALSE; curwin->w_cursor = search_start; /* start at old position */ + save_last_search_pattern(); /* If there is no command line, don't do anything */ if (ccline.cmdlen == 0) + { i = 0; + SET_NO_HLSEARCH(TRUE); /* turn off previous highlight */ + } else { + int search_flags = SEARCH_OPT + SEARCH_NOOF + SEARCH_PEEK; cursor_off(); /* so the user knows we're busy */ out_flush(); ++emsg_off; /* So it doesn't beep if bad expr */ @@ -1947,8 +1956,10 @@ cmdline_changed: /* Set the time limit to half a second. */ profile_setlimit(500L, &tm); #endif + if (!p_hls) + search_flags += SEARCH_KEEP; i = do_search(NULL, firstc, ccline.cmdbuff, count, - SEARCH_KEEP + SEARCH_OPT + SEARCH_NOOF + SEARCH_PEEK, + search_flags, #ifdef FEAT_RELTIME &tm, NULL #else @@ -2005,6 +2016,7 @@ cmdline_changed: save_cmdline(&save_ccline); update_screen(SOME_VALID); restore_cmdline(&save_ccline); + restore_last_search_pattern(); /* Leave it at the end to make CTRL-R CTRL-W work. */ if (i != 0) |