diff --git a/src/command_manager.cc b/src/command_manager.cc index 4d422feb..61c4f74c 100644 --- a/src/command_manager.cc +++ b/src/command_manager.cc @@ -562,18 +562,13 @@ Optional CommandManager::command_info(const Context& context, Strin return res; } -Completions CommandManager::complete_command_name(const Context& context, - StringView query, bool with_aliases) const +Completions CommandManager::complete_command_name(const Context& context, StringView query) const { auto commands = m_commands | filter([](const CommandMap::Item& cmd) { return not (cmd.value.flags & CommandFlags::Hidden); }) | transform(std::mem_fn(&CommandMap::Item::key)); - if (not with_aliases) - return {0, query.length(), Kakoune::complete(query, query.length(), commands)}; - - auto candidates = Kakoune::complete(query, query.length(), commands); - return {0, query.length(), std::move(candidates)}; + return {0, query.length(), Kakoune::complete(query, query.length(), commands)}; } Completions CommandManager::complete(const Context& context, @@ -606,7 +601,7 @@ Completions CommandManager::complete(const Context& context, { auto cmd_start = is_last_token ? cursor_pos : tokens[tok_idx].begin(); StringView query = command_line.substr(cmd_start, cursor_pos - cmd_start); - return offset_pos(complete_command_name(context, query, true), cmd_start); + return offset_pos(complete_command_name(context, query), cmd_start); } kak_assert(not tokens.empty()); @@ -685,7 +680,7 @@ Completions CommandManager::complete(const Context& context, StringView prefix = params[token_to_complete].substr(0, pos_in_token); if (token_to_complete == 0) - return complete_command_name(context, prefix, true); + return complete_command_name(context, prefix); else { StringView command_name = params[0]; diff --git a/src/command_manager.hh b/src/command_manager.hh index 0bf0bfdb..1337a190 100644 --- a/src/command_manager.hh +++ b/src/command_manager.hh @@ -102,7 +102,7 @@ public: CommandHelper helper = CommandHelper(), CommandCompleter completer = CommandCompleter()); - Completions complete_command_name(const Context& context, StringView query, bool with_aliases) const; + Completions complete_command_name(const Context& context, StringView query) const; void clear_last_complete_command() { m_last_complete_command = String{}; } diff --git a/src/commands.cc b/src/commands.cc index 4cb4dc90..bf92a628 100644 --- a/src/commands.cc +++ b/src/commands.cc @@ -168,7 +168,7 @@ static Completions complete_command_name(const Context& context, CompletionFlags const String& prefix, ByteCount cursor_pos) { return CommandManager::instance().complete_command_name( - context, prefix.substr(0, cursor_pos), false); + context, prefix.substr(0, cursor_pos)); }