Remove some dead code
This commit is contained in:
parent
e95fab0e7a
commit
eb2984807c
|
@ -562,18 +562,13 @@ Optional<CommandInfo> CommandManager::command_info(const Context& context, Strin
|
||||||
return res;
|
return res;
|
||||||
}
|
}
|
||||||
|
|
||||||
Completions CommandManager::complete_command_name(const Context& context,
|
Completions CommandManager::complete_command_name(const Context& context, StringView query) const
|
||||||
StringView query, bool with_aliases) const
|
|
||||||
{
|
{
|
||||||
auto commands = m_commands
|
auto commands = m_commands
|
||||||
| filter([](const CommandMap::Item& cmd) { return not (cmd.value.flags & CommandFlags::Hidden); })
|
| filter([](const CommandMap::Item& cmd) { return not (cmd.value.flags & CommandFlags::Hidden); })
|
||||||
| transform(std::mem_fn(&CommandMap::Item::key));
|
| transform(std::mem_fn(&CommandMap::Item::key));
|
||||||
|
|
||||||
if (not with_aliases)
|
|
||||||
return {0, query.length(), Kakoune::complete(query, query.length(), commands)};
|
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)};
|
|
||||||
}
|
}
|
||||||
|
|
||||||
Completions CommandManager::complete(const Context& context,
|
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();
|
auto cmd_start = is_last_token ? cursor_pos : tokens[tok_idx].begin();
|
||||||
StringView query = command_line.substr(cmd_start, cursor_pos - cmd_start);
|
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());
|
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);
|
StringView prefix = params[token_to_complete].substr(0, pos_in_token);
|
||||||
|
|
||||||
if (token_to_complete == 0)
|
if (token_to_complete == 0)
|
||||||
return complete_command_name(context, prefix, true);
|
return complete_command_name(context, prefix);
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
StringView command_name = params[0];
|
StringView command_name = params[0];
|
||||||
|
|
|
@ -102,7 +102,7 @@ public:
|
||||||
CommandHelper helper = CommandHelper(),
|
CommandHelper helper = CommandHelper(),
|
||||||
CommandCompleter completer = CommandCompleter());
|
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{}; }
|
void clear_last_complete_command() { m_last_complete_command = String{}; }
|
||||||
|
|
||||||
|
|
|
@ -168,7 +168,7 @@ static Completions complete_command_name(const Context& context, CompletionFlags
|
||||||
const String& prefix, ByteCount cursor_pos)
|
const String& prefix, ByteCount cursor_pos)
|
||||||
{
|
{
|
||||||
return CommandManager::instance().complete_command_name(
|
return CommandManager::instance().complete_command_name(
|
||||||
context, prefix.substr(0, cursor_pos), false);
|
context, prefix.substr(0, cursor_pos));
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue
Block a user