From 277fca9c6a26600ce8dc7cb2a035d412a9476868 Mon Sep 17 00:00:00 2001 From: Johannes Altmanninger Date: Sun, 3 Nov 2019 23:55:54 +0100 Subject: [PATCH] Complete all available commands on empty commandline --- src/complete.cpp | 12 +++++------- 1 file changed, 5 insertions(+), 7 deletions(-) diff --git a/src/complete.cpp b/src/complete.cpp index c22c8d6e2..94e162366 100644 --- a/src/complete.cpp +++ b/src/complete.cpp @@ -673,8 +673,6 @@ static wcstring complete_function_desc(const wcstring &fn) { /// /// \param str_cmd the command string to find completions for void completer_t::complete_cmd(const wcstring &str_cmd) { - if (str_cmd.empty()) return; - std::vector possible_comp; // Append all possible executables @@ -697,8 +695,9 @@ void completer_t::complete_cmd(const wcstring &str_cmd) { vars, parser, NULL); UNUSED(ignore); - if (str_cmd.find(L'/') == wcstring::npos && str_cmd.at(0) != L'~') { - wcstring_list_t names = function_get_names(str_cmd.at(0) == L'_'); + if (str_cmd.empty() || (str_cmd.find(L'/') == wcstring::npos && str_cmd.at(0) != L'~')) { + bool include_hidden = !str_cmd.empty() && str_cmd.at(0) == L'_'; + wcstring_list_t names = function_get_names(include_hidden); for (wcstring &name : names) { // Append all known matching functions append_completion(&possible_comp, std::move(name)); @@ -1485,9 +1484,8 @@ void completer_t::perform() { // Don't autosuggest anything based on the empty string (generalizes #1631). if (flags & completion_request_t::autosuggestion) return; - // fish has been using generic completion of filenames relative to the current directory. - // TODO there's some discussion in issue #5418 on what else we could do here. - complete_param_expand(L"", true /* do_file */); + complete_cmd(L""); + complete_abbr(L""); return; }