From 53fed4b8b937837c014f43d984878fa372cc5180 Mon Sep 17 00:00:00 2001 From: Maxime Coste Date: Tue, 4 Jul 2023 17:15:33 +1000 Subject: [PATCH] Only auto-insert completion when at the end of the line Auto inserting in the middle is annoying more often than not. --- src/input_handler.cc | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) 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); };