0
0
mirror of https://github.com/vim/vim.git synced 2025-09-23 03:43:49 -04:00

patch 8.0.1238: incremental search only shows one match

Problem:    Incremental search only shows one match.
Solution:   When 'incsearch' and and 'hlsearch' are both set highlight all
            matches. (haya14busa, closes #2198)
This commit is contained in:
Bram Moolenaar
2017-10-29 16:40:30 +01:00
parent af2d20c628
commit 2e51d9a097
6 changed files with 185 additions and 7 deletions

View File

@@ -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)