expand_abbreviation(): escape when looking up abbreviation vars

This was doing exactly the opposite: unescaping and not hitting
the encoded _fish_abbr_X variables when looking up.

Fixes #5573
This commit is contained in:
Aaron Gyes 2019-04-16 21:33:09 -07:00
parent 65bc94c493
commit 7e514d2aa5

View File

@ -1180,11 +1180,11 @@ bool fish_xdm_login_hack_hack_hack_hack(std::vector<std::string> *cmds, int argc
maybe_t<wcstring> expand_abbreviation(const wcstring &src, const environment_t &vars) {
if (src.empty()) return none();
wcstring unesc_src;
if (!unescape_string(src, &unesc_src, STRING_STYLE_VAR)) {
wcstring esc_src = escape_string(src, 0, STRING_STYLE_VAR);
if (esc_src.empty()) {
return none();
}
wcstring var_name = L"_fish_abbr_" + unesc_src;
wcstring var_name = L"_fish_abbr_" + esc_src;
if (auto var_value = vars.get(var_name)) {
return var_value->as_string();
}