[PATCH 3/3] less: Clear search-highlight if no matches
Denys Vlasenko
vda.linux at googlemail.com
Thu Jan 23 11:10:36 UTC 2014
On Tue, Jan 21, 2014 at 6:58 PM, Bernhard Reutner-Fischer
<rep.dot.nop at gmail.com> wrote:
> When looking at a file containing a word "foo", searching for foo
> highlights the word. Now search for "asddsa" (no match), we are supposed
> to clear the highlight of the previous foo, not key it off the validity
> of the regex.
> This makes the highlight disappear at least on the next redraw..
>
> Signed-off-by: Bernhard Reutner-Fischer <rep.dot.nop at gmail.com>
> ---
> miscutils/less.c | 2 +-
> 1 file changed, 1 insertion(+), 1 deletion(-)
>
> diff --git a/miscutils/less.c b/miscutils/less.c
> index cd553f6..6e187e6 100644
> --- a/miscutils/less.c
> +++ b/miscutils/less.c
> @@ -822,7 +822,7 @@ static void buffer_print(void)
>
> move_cursor(0, 0);
> for (i = 0; i <= max_displayed_line; i++)
> - if (pattern_valid)
> + if (num_matches)
> print_found(buffer[i]);
> else
> print_ascii(buffer[i]);
I can not reproduce the bug: I follow your instructions
and everything works as expected:
highlights on all instances of "foo" disappeared
on the new redraw.
More information about the busybox
mailing list