Skip to content

Commit

Permalink
find callback refactor
Browse files Browse the repository at this point in the history
  • Loading branch information
Kacperacy committed Mar 26, 2024
1 parent df4ab16 commit f803c41
Showing 1 changed file with 2 additions and 3 deletions.
5 changes: 2 additions & 3 deletions src/editor.rs
Original file line number Diff line number Diff line change
Expand Up @@ -346,9 +346,7 @@ impl Editor {
}

fn find(&mut self) {
if let Some(query) = self.prompt("Search: ", Some(Self::find_callback)) {
self.find_callback(&query, 0);
}
self.prompt("Search: ", Some(Self::find_callback));
}

fn prompt(
Expand All @@ -372,6 +370,7 @@ impl Editor {
} else if c.code == KeyCode::Enter {
if !input.is_empty() {
self.clear_status_message();
self.find_callback(&input, 0);
return Some(input);
}
} else if c.code == KeyCode::Backspace {
Expand Down

0 comments on commit f803c41

Please sign in to comment.