Merge remote-tracking branch 'lenormf/fix-completion-escaping'
This commit is contained in:
commit
8c2ef4965a
|
@ -759,7 +759,9 @@ Completions CommandManager::complete(const Context& context,
|
||||||
if (not (completions.flags & Completions::Flags::Quoted) and token.type == Token::Type::Raw)
|
if (not (completions.flags & Completions::Flags::Quoted) and token.type == Token::Type::Raw)
|
||||||
{
|
{
|
||||||
for (auto& c : completions.candidates)
|
for (auto& c : completions.candidates)
|
||||||
c = (not c.empty() and contains("%'\"", c[0]) ? "\\" : "") + escape(c, "; \t", '\\');
|
c = (not c.empty() and c[0] == '%') or
|
||||||
|
any_of(c, [](auto i) { return contains("; \t'\"", i); }) ?
|
||||||
|
format("'{}'", replace(c, "'", "''")) : c;
|
||||||
}
|
}
|
||||||
|
|
||||||
return completions;
|
return completions;
|
||||||
|
|
Loading…
Reference in New Issue
Block a user