Hi,
On Tue, Oct 10, 2017 at 11:32 PM, haya14busa <[email protected]> wrote:
> We can enable this feature without new 'inchlsearch' option and regardless
> 'hlsearch' with following patch.
>
I tested the below patch and it seems to work correctly.
>
> But, I wonder is it really ok to make it default behavior. IncSearch and
> Search highlight is similar in some colorscheme and when you type ., all
> characters will be highlighted.
> I thought someone may feel it's annoying behavior.
>
I agree. Enabling this behavior by default may surprise some existing
Vim users. Adding an option to control this behavior might be the way
to go (except that this will introduce one more option). New Vim users
may benefit from this feature if it is enabled by default.
Regards,
Yegappan
>
> What do you think?
>
> diff --git a/src/ex_getln.c b/src/ex_getln.c
> index 578a7c5fd..adc226fbf 100644
> --- a/src/ex_getln.c
> +++ b/src/ex_getln.c
> @@ -1681,10 +1681,12 @@ getcmdline(
> {
> pos_T t;
> int search_flags = SEARCH_NOOF + SEARCH_PEEK;
> + int save_p_hls = p_hls;
>
> if (char_avail())
> continue;
> save_last_search_pattern();
> + p_hls = TRUE;
> cursor_off();
> out_flush();
> if (c == Ctrl_G)
> @@ -1694,8 +1696,6 @@ getcmdline(
> }
> else
> t = match_start;
> - if (!p_ihls)
> - search_flags += SEARCH_KEEP;
> ++emsg_off;
> i = searchit(curwin, curbuf, &t,
> c == Ctrl_G ? FORWARD : BACKWARD,
> @@ -1748,6 +1748,7 @@ getcmdline(
> old_botline = curwin->w_botline;
> update_screen(NOT_VALID);
> restore_last_search_pattern();
> + p_hls = save_p_hls;
> redrawcmdline();
> }
> else
> @@ -1896,6 +1897,7 @@ cmdline_changed:
> #ifdef FEAT_RELTIME
> proftime_T tm;
> #endif
> + int save_p_hls = p_hls;
>
> /* if there is a character waiting, search and redraw later */
> if (char_avail())
> @@ -1906,6 +1908,7 @@ cmdline_changed:
> incsearch_postponed = FALSE;
> curwin->w_cursor = search_start; /* start at old position */
> save_last_search_pattern();
> + p_hls = TRUE;
>
> /* If there is no command line, don't do anything */
> if (ccline.cmdlen == 0)
> @@ -1923,8 +1926,6 @@ cmdline_changed:
> /* Set the time limit to half a second. */
> profile_setlimit(500L, &tm);
> #endif
> - if (!p_ihls)
> - search_flags += SEARCH_KEEP;
> i = do_search(NULL, firstc, ccline.cmdbuff, count,
> search_flags,
> #ifdef FEAT_RELTIME
> @@ -1984,6 +1985,7 @@ cmdline_changed:
> update_screen(SOME_VALID);
> restore_cmdline(&save_ccline);
> restore_last_search_pattern();
> + p_hls = save_p_hls;
>
> /* Leave it at the end to make CTRL-R CTRL-W work. */
> if (i != 0)
>
--
--
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.