summaryrefslogtreecommitdiff
path: root/src/insert_completer.cc
diff options
context:
space:
mode:
authorMaxime Coste <mawww@kakoune.org>2024-09-02 20:35:07 +1000
committerMaxime Coste <mawww@kakoune.org>2024-09-02 20:35:07 +1000
commitc1ce1d70146dd4b3cda76adc98bfac90da55d18c (patch)
tree7b30cb5dd23605630f29754727d1635e7a3e5407 /src/insert_completer.cc
parent6e5bc9dd6c477a71020dcbe6c7a387673825d941 (diff)
Explicitely call try_accept on InsertCompleter
Calling it as part of the insert method was error prone and often led to slightly surprising behaviour, such as the <c-r><esc> hiding the menu on <esc>.
Diffstat (limited to 'src/insert_completer.cc')
-rw-r--r--src/insert_completer.cc4
1 files changed, 2 insertions, 2 deletions
diff --git a/src/insert_completer.cc b/src/insert_completer.cc
index 1e83a47e..49bbd4ca 100644
--- a/src/insert_completer.cc
+++ b/src/insert_completer.cc
@@ -481,12 +481,12 @@ auto& get_last(BufferRange& range) { return range.end; }
bool InsertCompleter::has_candidate_selected() const
{
- return m_current_candidate >= 0 and m_current_candidate < m_completions.candidates.size() - 1;
+ return m_completions.is_valid() and m_current_candidate >= 0 and m_current_candidate < m_completions.candidates.size() - 1;
}
void InsertCompleter::try_accept()
{
- if (m_completions.is_valid() and has_candidate_selected())
+ if (has_candidate_selected())
reset();
}