Better search behaviour

This commit is contained in:
Joshua Barretto 2025-09-23 14:32:47 +01:00
parent 9cc9729ed9
commit b0b4de2f64
2 changed files with 3 additions and 7 deletions

View file

@ -322,7 +322,7 @@ impl RawEvent {
}
}
pub fn to_open_finder(&self, selection: Option<String>) -> Option<Action> {
pub fn to_open_finder(&self, query: Option<String>) -> Option<Action> {
if matches!(
&self.0,
TerminalEvent::Key(KeyEvent {
@ -332,7 +332,7 @@ impl RawEvent {
..
})
) {
Some(Action::OpenFinder(selection))
Some(Action::OpenFinder(query))
} else {
None
}

View file

@ -70,14 +70,10 @@ impl Element for Doc {
.to_owned()
.unwrap_or_else(|| std::env::current_dir().expect("no working dir"));
let selection = buffer.cursors[cursor_id]
.selection()
.map(|range| buffer.text.chars()[range].iter().copied().collect());
match event.to_action(|e| {
e.to_open_switcher()
.or_else(|| e.to_open_opener(open_path))
.or_else(|| e.to_open_finder(selection))
.or_else(|| e.to_open_finder(None))
.or_else(|| e.to_move())
.or_else(|| e.to_save())
}) {