diff options
| author | Johannes Altmanninger <aclopte@gmail.com> | 2022-07-19 10:04:32 +0200 |
|---|---|---|
| committer | Johannes Altmanninger <aclopte@gmail.com> | 2022-07-21 16:48:44 +0200 |
| commit | ba557e90a26e75c9222859b63237a60e94d8d794 (patch) | |
| tree | 25862b345706ee2f7533844861018a2d4d75bc11 /src/command_manager.cc | |
| parent | 1358fc3ceff6b56afb4ce8bf8fd1a0df4cb99f19 (diff) | |
Offer "--" as completion when completing switches
The next commit will give switch completions the menu behavior, so this
is necessary so we can still type "echo --" without an auto-expansion
to "echo -to-file".
Diffstat (limited to 'src/command_manager.cc')
| -rw-r--r-- | src/command_manager.cc | 5 |
1 files changed, 3 insertions, 2 deletions
diff --git a/src/command_manager.cc b/src/command_manager.cc index 30684d85..e014d1d3 100644 --- a/src/command_manager.cc +++ b/src/command_manager.cc @@ -766,8 +766,9 @@ Completions CommandManager::complete(const Context& context, if (is_switch(token.content)) { auto switches = Kakoune::complete(token.content.substr(1_byte), pos_in_token, - command.param_desc.switches | - transform(&SwitchMap::Item::key)); + concatenated(command.param_desc.switches + | transform(&SwitchMap::Item::key), + ConstArrayView<String>{"-"})); return switches.empty() ? Completions{} : Completions{start+1, cursor_pos, std::move(switches)}; } if (not command.completer) |
