1
1
mirror of https://github.com/mawww/kakoune.git synced 2024-12-14 21:53:14 +03:00

Remove redundant handling of "-add" from set-option completer

Switches are removed before invoking a command's completer (look for
"std::not_fn(is_switch)". Remove completer code that attempts to
handle switches.
This commit is contained in:
Johannes Altmanninger 2022-07-19 12:02:55 +02:00
parent e83dbdcd2c
commit 4b6abfaedf

View File

@ -1666,9 +1666,6 @@ const CommandDesc set_option_cmd = {
CommandParameters params, size_t token_to_complete, CommandParameters params, size_t token_to_complete,
ByteCount pos_in_token) -> Completions ByteCount pos_in_token) -> Completions
{ {
const bool add = params.size() > 1 and params[0] == "-add";
const int start = add ? 1 : 0;
static constexpr auto scopes = { "global", "buffer", "window", "current" }; static constexpr auto scopes = { "global", "buffer", "window", "current" };
if (token_to_complete == 0) if (token_to_complete == 0)
@ -1680,7 +1677,7 @@ const CommandDesc set_option_cmd = {
else if (token_to_complete == 2 and params[2].empty() and else if (token_to_complete == 2 and params[2].empty() and
GlobalScope::instance().option_registry().option_exists(params[1])) GlobalScope::instance().option_registry().option_exists(params[1]))
{ {
OptionManager& options = get_scope(params[start], context).options(); OptionManager& options = get_scope(params[0], context).options();
return {0_byte, params[2].length(), return {0_byte, params[2].length(),
{options[params[1]].get_as_string(Quoting::Kakoune)}, {options[params[1]].get_as_string(Quoting::Kakoune)},
Completions::Flags::Quoted}; Completions::Flags::Quoted};