Skip to content

Commit

Permalink
implement match clearing and add a keybinding for it
Browse files Browse the repository at this point in the history
  • Loading branch information
resolritter committed Sep 7, 2020
1 parent 82a7023 commit 57a542f
Show file tree
Hide file tree
Showing 3 changed files with 16 additions and 0 deletions.
1 change: 1 addition & 0 deletions les.h
Original file line number Diff line number Diff line change
Expand Up @@ -227,6 +227,7 @@ void next_match ();
void prev_match ();
void load_search_history ();
void save_search_history ();
void clear_matches ();

#endif

3 changes: 3 additions & 0 deletions main.c
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand Down
12 changes: 12 additions & 0 deletions search.c
Original file line number Diff line number Diff line change
Expand Up @@ -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++;
Expand Down

0 comments on commit 57a542f

Please sign in to comment.