Trigger directory completion upon pressing Enter

pull/146/head
Kevin Sjöberg 2021-06-05 22:40:11 +02:00 committed by Blaž Hrastnik
parent 54f3548d54
commit 145bc1970a
1 changed files with 7 additions and 2 deletions

View File

@ -253,8 +253,13 @@ impl Component for Prompt {
code: KeyCode::Enter,
..
} => {
(self.callback_fn)(cx.editor, &self.line, PromptEvent::Validate);
return close_fn;
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);
return close_fn;
}
}
KeyEvent {
code: KeyCode::Tab, ..