mirror of
https://github.com/fish-shell/fish-shell.git
synced 2024-11-23 12:28:39 +08:00
Unexpand abbreviations' variable names before completing them
Fixes #6166
This commit is contained in:
parent
1602902e12
commit
7017a2fcf9
|
@ -1211,7 +1211,9 @@ std::map<wcstring, wcstring> get_abbreviations(const environment_t &vars) {
|
|||
std::map<wcstring, wcstring> result;
|
||||
for (const wcstring &name : names) {
|
||||
if (string_prefixes_string(prefix, name)) {
|
||||
result[name.substr(prefix.size())] = vars.get(name)->as_string();
|
||||
wcstring key;
|
||||
unescape_string(name.substr(prefix.size()), &key, UNESCAPE_DEFAULT, STRING_STYLE_VAR);
|
||||
result[key] = vars.get(name)->as_string();
|
||||
}
|
||||
}
|
||||
return result;
|
||||
|
|
|
@ -177,6 +177,7 @@ wcstring replace_home_directory_with_tilde(const wcstring &str, const environmen
|
|||
maybe_t<wcstring> expand_abbreviation(const wcstring &src, const environment_t &vars);
|
||||
|
||||
/// \return a snapshot of all abbreviations as a map abbreviation->expansion.
|
||||
/// The abbreviations are unescaped, i.e. they may not be valid variable identifiers (#6166).
|
||||
std::map<wcstring, wcstring> get_abbreviations(const environment_t &vars);
|
||||
|
||||
// Terrible hacks
|
||||
|
|
|
@ -85,3 +85,7 @@ abbr __abbr11 omega11
|
|||
abbr __abbr12 omega12
|
||||
abbr -r __abbr11 __abbr12
|
||||
# CHECKERR: abbr --rename: Abbreviation __abbr12 already exists, cannot rename __abbr11
|
||||
|
||||
abbr __abbr-with-dashes omega
|
||||
complete -C__abbr-with
|
||||
# CHECK: __abbr-with-dashes Abbreviation: omega
|
||||
|
|
Loading…
Reference in New Issue
Block a user