aboutsummaryrefslogtreecommitdiff
path: root/helix-term/src
diff options
context:
space:
mode:
authorKevin Sjöberg2021-06-05 20:40:11 +0000
committerBlaž Hrastnik2021-06-06 12:48:19 +0000
commit145bc1970a49a7056b34d3a6f8278a6886acf373 (patch)
tree295576e5114f06105d070d1bb1063ba7efac5bc1 /helix-term/src
parent54f3548d541c3fc6fd793aeacb584cbe0d934b82 (diff)
Trigger directory completion upon pressing Enter
Diffstat (limited to 'helix-term/src')
-rw-r--r--helix-term/src/ui/prompt.rs9
1 files changed, 7 insertions, 2 deletions
diff --git a/helix-term/src/ui/prompt.rs b/helix-term/src/ui/prompt.rs
index cdf303b8..0a88aa90 100644
--- a/helix-term/src/ui/prompt.rs
+++ b/helix-term/src/ui/prompt.rs
@@ -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, ..