Fix auto escaping of command argument completion
This commit is contained in:
parent
51cff07821
commit
6a31d0ebc7
|
@ -676,11 +676,10 @@ Completions CommandManager::complete(const Context& context,
|
||||||
context, flags, params, tokens.size() - 2,
|
context, flags, params, tokens.size() - 2,
|
||||||
cursor_pos_in_token), start);
|
cursor_pos_in_token), start);
|
||||||
|
|
||||||
if (not completions.quoted and token.type != Token::Type::RawQuoted)
|
if (not completions.quoted and token.type == Token::Type::Raw)
|
||||||
{
|
{
|
||||||
StringView to_escape = token.type == Token::Type::Raw ? "% \t;" : "%";
|
for (auto& c : completions.candidates)
|
||||||
for (auto& candidate : completions.candidates)
|
c = (not c.empty() and contains("%'\"", c[0]) ? "\\" : "") + escape(c, "; \t", '\\');
|
||||||
candidate = escape(candidate, to_escape, '\\');
|
|
||||||
}
|
}
|
||||||
|
|
||||||
return completions;
|
return completions;
|
||||||
|
|
Loading…
Reference in New Issue
Block a user