diff --git a/les.h b/les.h index b28e60e..5e3a19a 100644 --- a/les.h +++ b/les.h @@ -227,6 +227,7 @@ void next_match (); void prev_match (); void load_search_history (); void save_search_history (); +void clear_matches (); #endif diff --git a/main.c b/main.c index c46691e..da1efb9 100644 --- a/main.c +++ b/main.c @@ -312,6 +312,9 @@ int read_key (char *buf, int len) { case '/': search(); break; + case 'c': + clear_matches(); + break; case -0x40 + 'D': move_forward(10000); break; diff --git a/search.c b/search.c index 66067ba..202e7e8 100644 --- a/search.c +++ b/search.c @@ -191,6 +191,18 @@ void save_search_history () { fclose(fp); } +void clear_matches() { + tabb->matches = NULL; + tabb->matches_len = 0; + tabb->matches_size = 0; + tabb->current_match = 0; + tabb->highlights = NULL; + tabb->highlights_len = 0; + tabb->highlights_size = 0; + tabb->highlights_processed = 0; + draw_tab(); +} + void search2 (char *pattern) { active_search = 0; search_version++;