summaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorJohannes Altmanninger <aclopte@gmail.com>2022-07-19 09:42:20 +0200
committerJohannes Altmanninger <aclopte@gmail.com>2022-07-21 16:48:44 +0200
commit8fac31ba76e6036229baa751c41c21695f07372d (patch)
tree25b8b991ec00ed70b2b948ea48bf2e128c36746a /src
parentba557e90a26e75c9222859b63237a60e94d8d794 (diff)
Use menu behavior for completion of switches
We already use the menu behavior in complete_command_name(); let's do the same for switches, since we can complete all valid inputs and it can save a Tab key in some scenarios. CommandManager::complete is fairly complex. We can't expect callers to add the menu bit when appropriate, so we currently do it here.
Diffstat (limited to 'src')
-rw-r--r--src/command_manager.cc4
1 files changed, 3 insertions, 1 deletions
diff --git a/src/command_manager.cc b/src/command_manager.cc
index e014d1d3..1fb82731 100644
--- a/src/command_manager.cc
+++ b/src/command_manager.cc
@@ -769,7 +769,9 @@ Completions CommandManager::complete(const Context& context,
concatenated(command.param_desc.switches
| transform(&SwitchMap::Item::key),
ConstArrayView<String>{"-"}));
- return switches.empty() ? Completions{} : Completions{start+1, cursor_pos, std::move(switches)};
+ return switches.empty()
+ ? Completions{}
+ : Completions{start+1, cursor_pos, std::move(switches), Completions::Flags::Menu};
}
if (not command.completer)
return Completions{};