mirror of
https://github.com/fish-shell/fish-shell.git
synced 2025-02-21 05:13:56 +08:00
Clean up weird edge-case for escaping unescaped brackets
As explained by the comment, this was dead code. If it were ever executed, it would cause very weird behavior because it would make some completions randomly affect others. Let's just print a warning (maybe this is better than crashing?).
This commit is contained in:
parent
12cf31de96
commit
7bdc712615
@ -1436,11 +1436,12 @@ void completer_t::escape_opening_brackets(const wcstring &argument) {
|
||||
if (comp.flags & COMPLETE_REPLACES_TOKEN) continue;
|
||||
comp.flags |= COMPLETE_REPLACES_TOKEN;
|
||||
comp.flags |= COMPLETE_DONT_ESCAPE_TILDES; // See #9073.
|
||||
// We are grafting a completion that is expected to be escaped later. This will break
|
||||
// if the original completion doesn't want escaping. Happily, this is only the case
|
||||
// for username completion and variable name completion. They shouldn't end up here
|
||||
// anyway because they won't contain '['.
|
||||
if (comp.flags & COMPLETE_DONT_ESCAPE) {
|
||||
// If the completion won't be escaped, we need to do it here.
|
||||
// Currently, this will probably never happen since COMPLETE_DONT_ESCAPE
|
||||
// is only set for user or variable names which cannot contain '['.
|
||||
unescaped_argument = escape_string(unescaped_argument, ESCAPE_ALL);
|
||||
FLOG(warning, L"unexpected completion flag");
|
||||
}
|
||||
comp.completion = unescaped_argument + comp.completion;
|
||||
}
|
||||
|
Loading…
x
Reference in New Issue
Block a user