Restore auto-select on return, add a flag to disable that for commands
Fixes #3849 Again
This commit is contained in:
parent
cdcf4b0c7d
commit
161aa918df
|
@ -630,7 +630,9 @@ Completions CommandManager::complete_command_name(const Context& context, String
|
|||
auto aliases = context.aliases().flatten_aliases()
|
||||
| transform(&HashItem<String, String>::key);
|
||||
|
||||
return {0, query.length(), Kakoune::complete(query, query.length(), concatenated(commands, aliases)), Completions::Flags::Menu};
|
||||
return {0, query.length(),
|
||||
Kakoune::complete(query, query.length(), concatenated(commands, aliases)),
|
||||
Completions::Flags::Menu | Completions::Flags::NoEmpty};
|
||||
}
|
||||
|
||||
Completions CommandManager::complete_module_name(StringView query) const
|
||||
|
|
|
@ -22,7 +22,8 @@ struct Completions
|
|||
{
|
||||
None = 0,
|
||||
Quoted = 0b1,
|
||||
Menu = 0b10
|
||||
Menu = 0b10,
|
||||
NoEmpty = 0b100
|
||||
};
|
||||
|
||||
constexpr friend bool with_bit_ops(Meta::Type<Flags>) { return true; }
|
||||
|
|
|
@ -775,7 +775,10 @@ public:
|
|||
const bool has_completions = not m_completions.candidates.empty();
|
||||
const bool completion_selected = m_current_completion != -1;
|
||||
const bool text_entered = m_completions.start != line.byte_count_to(m_line_editor.cursor_pos());
|
||||
return has_completions and not completion_selected and text_entered;
|
||||
return (m_completions.flags & Completions::Flags::Menu) and
|
||||
has_completions and
|
||||
not completion_selected and
|
||||
(not (m_completions.flags & Completions::Flags::NoEmpty) or text_entered);
|
||||
};
|
||||
|
||||
if (key == Key::Return)
|
||||
|
@ -997,7 +1000,6 @@ public:
|
|||
else
|
||||
{
|
||||
if (key == ' ' and
|
||||
(m_completions.flags & Completions::Flags::Menu) and
|
||||
not (m_completions.flags & Completions::Flags::Quoted) and // if token is quoted, this space does not end it
|
||||
can_auto_insert_completion())
|
||||
m_line_editor.insert_from(line.char_count_to(m_completions.start),
|
||||
|
|
Loading…
Reference in New Issue
Block a user