Skip to content

Commit

Permalink
fix(find): remove highlights when no input
Browse files Browse the repository at this point in the history
  • Loading branch information
metiftikci committed Oct 23, 2023
1 parent 26062ea commit 2e33c78
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 4 deletions.
4 changes: 4 additions & 0 deletions src/buffer/find.rs
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,10 @@ impl Buffer {
self.clear_highlight(HL_FIND_TEXT);
self.finds.clear();

if text.len() == 0 {
return;
}

for row in 0..self.get_line_count() {
let line = self.get_line(row).clone();
if text.len() <= line.len() {
Expand Down
6 changes: 2 additions & 4 deletions src/editor.rs
Original file line number Diff line number Diff line change
Expand Up @@ -144,10 +144,8 @@ impl Editor {
other => {
self.input.handle_key(other);
let text = self.input.text.clone();
if text.len() > 0 {
let buffer = self.get_active_buffer_or_popup_mut();
buffer.find(&text);
}
let buffer = self.get_active_buffer_or_popup_mut();
buffer.find(&text);
}
};
}
Expand Down

0 comments on commit 2e33c78

Please sign in to comment.