summaryrefslogtreecommitdiff
path: root/src/command_manager.cc
diff options
context:
space:
mode:
authorJohannes Altmanninger <aclopte@gmail.com>2022-07-31 07:38:46 +0200
committerJohannes Altmanninger <aclopte@gmail.com>2022-08-01 12:34:22 +0200
commite13b43578369652ef5acb0e2295d889bc7191018 (patch)
tree3888e086b2d9786174d4cc2f81228d280a9b3825 /src/command_manager.cc
parente83dbdcd2cbddb30ac63ec503c76b46b80ffe44d (diff)
Do not complete command switches after --
Recently, switch completion were given the menu behavior. Unfortunately this breaks cases like :echo -- -mark<ret> where the hypothetical user wanted to actually display "-mark", not "-markup". Simply bail if there is a double-dash. This is not fully correct, for example it wrongly disables switch completion on echo -to-file -- - but that's minor, we can fix it later. In future, we should reuse the ParametersParser when computing completions, which will obsolete this workaround.
Diffstat (limited to 'src/command_manager.cc')
-rw-r--r--src/command_manager.cc3
1 files changed, 2 insertions, 1 deletions
diff --git a/src/command_manager.cc b/src/command_manager.cc
index 48d7789e..5e2253bd 100644
--- a/src/command_manager.cc
+++ b/src/command_manager.cc
@@ -808,7 +808,8 @@ Completions CommandManager::complete(const Context& context,
const bool has_switches = not command.param_desc.switches.empty();
auto is_switch = [=](StringView s) { return has_switches and s.substr(0_byte, 1_byte) == "-"; };
- if (is_switch(token.content))
+ if (is_switch(token.content)
+ and not contains(tokens | drop(1) | transform(&Token::content), "--"))
{
auto switches = Kakoune::complete(token.content.substr(1_byte), pos_in_token,
concatenated(command.param_desc.switches