on master help sign in
Trigger directory completion upon pressing Enter
commit145bc1970a49a7056b34d3a6f8278a6886acf373 authorKevin Sjöberg <mail@kevinsjoberg.com> dateSat 5 Jun 2021, 22:40 (5 years ago) parent54f3548
1 file changed+7−2
helix-term/src/ui/prompt.rs+7−2
helix-term/src/ui/prompt.rs+7−2
@@ -253,8 +253,13 @@ impl Component for Prompt {
253253 code: KeyCode::Enter,
254254 ..
255255 } => {
256− (self.callback_fn)(cx.editor, &self.line, PromptEvent::Validate);
257− return close_fn;
256+ if self.line.ends_with('/') {
257+ self.completion = (self.completion_fn)(&self.line);
258+ self.exit_selection();
259+ } else {
260+ (self.callback_fn)(cx.editor, &self.line, PromptEvent::Validate);
261+ return close_fn;
262+ }
258263 }
259264 KeyEvent {
260265 code: KeyCode::Tab, ..