diff --git a/src/expand.cpp b/src/expand.cpp index 1d0b1601c..6b5968034 100644 --- a/src/expand.cpp +++ b/src/expand.cpp @@ -1207,6 +1207,12 @@ maybe_t expand_abbreviation(const wcstring &src, const environment_t & return none(); } +maybe_t expand_abbreviation(const wcstring &src) { + // FIXME: We use the principal environment stack because we don't know which variables need to + // be captured in a snapshot. + return expand_abbreviation(src, env_stack_t::principal()); +} + std::map get_abbreviations() { // TODO: try to make this cheaper const auto &vars = env_stack_t::principal(); diff --git a/src/expand.h b/src/expand.h index 180ed9d2f..8dd0da247 100644 --- a/src/expand.h +++ b/src/expand.h @@ -161,6 +161,7 @@ wcstring replace_home_directory_with_tilde(const wcstring &str, const environmen /// Abbreviation support. Expand src as an abbreviation, returning the expanded form if found, /// none() if not. maybe_t expand_abbreviation(const wcstring &src, const environment_t &vars); +maybe_t expand_abbreviation(const wcstring &src); /// \return a snapshot of all abbreviations as a map abbreviation->expansion. std::map get_abbreviations(); diff --git a/src/highlight.cpp b/src/highlight.cpp index cda55083b..9b844f89f 100644 --- a/src/highlight.cpp +++ b/src/highlight.cpp @@ -1015,7 +1015,7 @@ static bool command_is_valid(const wcstring &cmd, enum parse_statement_decoratio if (!is_valid && function_ok) is_valid = function_exists_no_autoload(cmd, vars); // Abbreviations - if (!is_valid && abbreviation_ok) is_valid = expand_abbreviation(cmd, vars).has_value(); + if (!is_valid && abbreviation_ok) is_valid = expand_abbreviation(cmd).has_value(); // Regular commands if (!is_valid && command_ok) is_valid = path_get_path(cmd, NULL, vars);