1
1
mirror of https://github.com/mawww/kakoune.git synced 2024-09-21 09:59:08 +03:00

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".
This commit is contained in:
Johannes Altmanninger 2022-07-19 10:04:32 +02:00
parent 1358fc3cef
commit ba557e90a2

View File

@ -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)