1
1
mirror of https://github.com/mawww/kakoune.git synced 2024-11-23 23:34:12 +03:00

Merge remote-tracking branch 'lenormf/fix-completion-escaping'

This commit is contained in:
Maxime Coste 2020-03-13 08:08:17 +11:00
commit 8c2ef4965a

View File

@ -759,7 +759,9 @@ Completions CommandManager::complete(const Context& context,
if (not (completions.flags & Completions::Flags::Quoted) and token.type == Token::Type::Raw)
{
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;