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>.
pull/2372/head
Roland Kovacs 3 years ago committed by GitHub
parent f85f0b7272
commit 567ddef388
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

@ -526,6 +526,11 @@ impl Component for Prompt {
} }
key!(Tab) => { key!(Tab) => {
self.change_completion_selection(CompletionDirection::Forward); self.change_completion_selection(CompletionDirection::Forward);
// if single completion candidate is a directory list content in completion
if self.completion.len() == 1 && self.line.ends_with(std::path::MAIN_SEPARATOR) {
self.recalculate_completion(cx.editor);
self.exit_selection();
}
(self.callback_fn)(cx, &self.line, PromptEvent::Update) (self.callback_fn)(cx, &self.line, PromptEvent::Update)
} }
shift!(Tab) => { shift!(Tab) => {

Loading…
Cancel
Save