From 4b6abfaedf05a232e4737d85c62e0c01e7550203 Mon Sep 17 00:00:00 2001 From: Johannes Altmanninger Date: Tue, 19 Jul 2022 12:02:55 +0200 Subject: [PATCH] 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. --- src/commands.cc | 5 +---- 1 file changed, 1 insertion(+), 4 deletions(-) diff --git a/src/commands.cc b/src/commands.cc index f07c768b..f08acb34 100644 --- a/src/commands.cc +++ b/src/commands.cc @@ -1666,9 +1666,6 @@ const CommandDesc set_option_cmd = { CommandParameters params, size_t token_to_complete, 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" }; 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 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(), {options[params[1]].get_as_string(Quoting::Kakoune)}, Completions::Flags::Quoted};