Merge remote-tracking branch 'krobelus/no-switches-after-ddash'

This commit is contained in:
Maxime Coste 2022-08-03 19:50:00 +10:00
commit 4361a7e120

View File

@ -808,7 +808,8 @@ Completions CommandManager::complete(const Context& context,
const bool has_switches = not command.param_desc.switches.empty(); 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) == "-"; }; 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, auto switches = Kakoune::complete(token.content.substr(1_byte), pos_in_token,
concatenated(command.param_desc.switches concatenated(command.param_desc.switches