[PATCH 3/3] less: Clear search-highlight if no matches

Bernhard Reutner-Fischer rep.dot.nop at gmail.com
Tue Jan 21 17:58:46 UTC 2014


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]);
-- 
1.8.5.2



More information about the busybox mailing list