summaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorMaxime Coste <mawww@kakoune.org>2018-06-23 12:43:06 +1000
committerMaxime Coste <mawww@kakoune.org>2018-07-05 07:54:28 +1000
commit6a31d0ebc796ef216afb27404a0f900216c4ef2a (patch)
tree20ce16876354126cae03e0cf6d81d2bc1b1ba09a /src
parent51cff07821b57299b2f25f7de9ab0d50a23ac155 (diff)
Fix auto escaping of command argument completion
Diffstat (limited to 'src')
-rw-r--r--src/command_manager.cc7
1 files changed, 3 insertions, 4 deletions
diff --git a/src/command_manager.cc b/src/command_manager.cc
index 9209509d..7c6c669d 100644
--- a/src/command_manager.cc
+++ b/src/command_manager.cc
@@ -676,11 +676,10 @@ Completions CommandManager::complete(const Context& context,
context, flags, params, tokens.size() - 2,
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& candidate : completions.candidates)
- candidate = escape(candidate, to_escape, '\\');
+ for (auto& c : completions.candidates)
+ c = (not c.empty() and contains("%'\"", c[0]) ? "\\" : "") + escape(c, "; \t", '\\');
}
return completions;