Auto-complete directory members (#1801) (#1907)
Allow tab-completion to continue when there is only a single, unambigous
completion target which is a directory. This allows e.g. nested directories
to be quickly drilled down just by hitting <tab> instead of first selecting
the completion then hitting <enter>.
commit567ddef388986dd2cea5c7f3eb1aa1a978c3e6d3
authorRoland Kovacs <zen3ger@tutanota.com>
dateMon 2 May 2022, 16:18 (4 years ago)
parentf85f0b7
helix-term/src/ui/prompt.rs+5
@@ -526,6 +526,11 @@ impl Component for Prompt {
526526 }
527527 key!(Tab) => {
528528 self.change_completion_selection(CompletionDirection::Forward);
529+ // if single completion candidate is a directory list content in completion
530+ if self.completion.len() == 1 && self.line.ends_with(std::path::MAIN_SEPARATOR) {
531+ self.recalculate_completion(cx.editor);
532+ self.exit_selection();
533+ }
529534 (self.callback_fn)(cx, &self.line, PromptEvent::Update)
530535 }
531536 shift!(Tab) => {