Trigger directory completion upon pressing Enter

pull/146/head
Kevin Sjöberg 3 years ago committed by Blaž Hrastnik
parent 54f3548d54
commit 145bc1970a

@ -253,9 +253,14 @@ impl Component for Prompt {
code: KeyCode::Enter, code: KeyCode::Enter,
.. ..
} => { } => {
if self.line.ends_with('/') {
self.completion = (self.completion_fn)(&self.line);
self.exit_selection();
} else {
(self.callback_fn)(cx.editor, &self.line, PromptEvent::Validate); (self.callback_fn)(cx.editor, &self.line, PromptEvent::Validate);
return close_fn; return close_fn;
} }
}
KeyEvent { KeyEvent {
code: KeyCode::Tab, .. code: KeyCode::Tab, ..
} => self.change_completion_selection(), } => self.change_completion_selection(),

Loading…
Cancel
Save