diff --git a/src/complete.cpp b/src/complete.cpp index d4091855d..37929e372 100644 --- a/src/complete.cpp +++ b/src/complete.cpp @@ -707,7 +707,7 @@ void completer_t::complete_cmd(const wcstring &str_cmd, bool use_function, bool } void completer_t::complete_abbr(const wcstring &cmd) { - std::map abbrs = get_abbreviations(); + std::map abbrs = get_abbreviations(vars); std::vector possible_comp; possible_comp.reserve(abbrs.size()); for (const auto &kv : abbrs) { diff --git a/src/expand.cpp b/src/expand.cpp index 4beb8ede8..aa91f3d4b 100644 --- a/src/expand.cpp +++ b/src/expand.cpp @@ -1197,9 +1197,8 @@ maybe_t expand_abbreviation(const wcstring &src) { return expand_abbreviation(src, env_stack_t::principal()); } -std::map get_abbreviations() { +std::map get_abbreviations(const environment_t &vars) { // TODO: try to make this cheaper - const auto &vars = env_stack_t::principal(); const size_t fish_abbr_len = std::wcslen(L"_fish_abbr_"); auto names = vars.get_names(0); std::map result; @@ -1210,4 +1209,3 @@ std::map get_abbreviations() { } return result; } - diff --git a/src/expand.h b/src/expand.h index 2386f45c4..84500c37e 100644 --- a/src/expand.h +++ b/src/expand.h @@ -165,7 +165,7 @@ maybe_t expand_abbreviation(const wcstring &src, const environment_t & maybe_t expand_abbreviation(const wcstring &src); /// \return a snapshot of all abbreviations as a map abbreviation->expansion. -std::map get_abbreviations(); +std::map get_abbreviations(const environment_t &vars); // Terrible hacks bool fish_xdm_login_hack_hack_hack_hack(std::vector *cmds, int argc,