summaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorJohannes Altmanninger <aclopte@gmail.com>2023-02-12 20:29:27 +0100
committerJohannes Altmanninger <aclopte@gmail.com>2023-02-17 20:50:58 +0100
commit9e0502a1ca234bd20e17f078e75c3d5da4687a82 (patch)
treebfb06e68c2251b412d629972cff97dc45727fc94 /src
parent64d4d29d43c78a403cff81d52ad0dabe06518f51 (diff)
Do not complete redundant switches
Diffstat (limited to 'src')
-rw-r--r--src/command_manager.cc5
1 files changed, 4 insertions, 1 deletions
diff --git a/src/command_manager.cc b/src/command_manager.cc
index a2f1aad5..caae2776 100644
--- a/src/command_manager.cc
+++ b/src/command_manager.cc
@@ -821,7 +821,10 @@ Completions CommandManager::complete(const Context& context,
{
auto switches = Kakoune::complete(token.content.substr(1_byte), pos_in_token,
concatenated(command.param_desc.switches
- | transform(&SwitchMap::Item::key),
+ | transform(&SwitchMap::Item::key)
+ | filter([&](const auto& key) {
+ return not parser.get_switch(key);
+ }),
ConstArrayView<String>{"-"}));
return switches.empty()
? Completions{}