summaryrefslogtreecommitdiff
path: root/src/input_handler.cc
diff options
context:
space:
mode:
authorMaxime Coste <mawww@kakoune.org>2020-11-17 07:03:14 +1100
committerMaxime Coste <mawww@kakoune.org>2020-11-17 07:03:14 +1100
commit14dbe63b4f31b4470d4165b87a467a4434cdce92 (patch)
tree79f9b23aafc564c7c215dd90f631a6bc90255515 /src/input_handler.cc
parent27e95ed6579adf40921bdad66bc4fc7fee94d539 (diff)
Revert "Auto-insert prompt menu completions on <ret> if any text was entered"
Unfortunately this breaks some pretty useful use cases, such as inserting a command ending with a new-line (as it now leads to an addtional command being auto-completed on validation) This reverts commit aab0be529f77f3a8e86185a030838e6d547d0286.
Diffstat (limited to 'src/input_handler.cc')
-rw-r--r--src/input_handler.cc8
1 files changed, 4 insertions, 4 deletions
diff --git a/src/input_handler.cc b/src/input_handler.cc
index 552eef0d..f4376ae2 100644
--- a/src/input_handler.cc
+++ b/src/input_handler.cc
@@ -771,16 +771,16 @@ public:
{
const String& line = m_line_editor.line();
- auto can_auto_insert_completion = [&] (bool check_token) {
+ auto can_auto_insert_completion = [&] {
const bool has_completions = not m_completions.candidates.empty();
const bool completion_selected = m_current_completion != -1;
- const bool text_entered = check_token ? m_completions.start != line.byte_count_to(m_line_editor.cursor_pos()) : !line.empty();
+ 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;
};
if (key == Key::Return)
{
- if ((m_completions.flags & Completions::Flags::Menu) and can_auto_insert_completion(false))
+ if ((m_completions.flags & Completions::Flags::Menu) and can_auto_insert_completion())
{
const String& completion = m_completions.candidates.front();
m_line_editor.insert_from(line.char_count_to(m_completions.start),
@@ -999,7 +999,7 @@ public:
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(true))
+ can_auto_insert_completion())
m_line_editor.insert_from(line.char_count_to(m_completions.start),
m_completions.candidates.front());