diff options
| author | Maxime Coste <mawww@kakoune.org> | 2023-07-04 17:15:33 +1000 |
|---|---|---|
| committer | Maxime Coste <mawww@kakoune.org> | 2023-07-04 17:15:33 +1000 |
| commit | 53fed4b8b937837c014f43d984878fa372cc5180 (patch) | |
| tree | e6f37b5c504e424fd1e80def36f6c389e82309e5 /src/input_handler.cc | |
| parent | 661d1a090572323627ccdb16aeba4e6adf4ca59a (diff) | |
Only auto-insert completion when at the end of the line
Auto inserting in the middle is annoying more often than not.
Diffstat (limited to 'src/input_handler.cc')
| -rw-r--r-- | src/input_handler.cc | 3 |
1 files changed, 2 insertions, 1 deletions
diff --git a/src/input_handler.cc b/src/input_handler.cc index a36d13f1..08bcdd51 100644 --- a/src/input_handler.cc +++ b/src/input_handler.cc @@ -815,9 +815,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()); + const bool at_end = line.byte_count_to(m_line_editor.cursor_pos()) == line.length(); return (m_completions.flags & Completions::Flags::Menu) and has_completions and - not completion_selected and + not completion_selected and at_end and (not (m_completions.flags & Completions::Flags::NoEmpty) or text_entered); }; |
