From 50325e62b06c4df3c428a19166b45b95e78511c1 Mon Sep 17 00:00:00 2001 From: Maxime Coste Date: Thu, 28 Nov 2013 18:44:42 +0000 Subject: [PATCH] fix prompt completion handling misbehaving with history --- src/input_handler.cc | 17 ++++++++++++++--- 1 file changed, 14 insertions(+), 3 deletions(-) diff --git a/src/input_handler.cc b/src/input_handler.cc index 81de3d72..b8c4470f 100644 --- a/src/input_handler.cc +++ b/src/input_handler.cc @@ -386,6 +386,9 @@ public: break; } } while (it != history.begin()); + + clear_completions(); + showcompl = true; } } else if (key == Key::Down or key == ctrl('n')) // next @@ -402,6 +405,9 @@ public: m_line_editor.reset(*m_history_it); else m_line_editor.reset(m_prefix); + + clear_completions(); + showcompl = true; } } else if (key == ctrl('i') or key == Key::BackTab) // tab completion @@ -455,9 +461,7 @@ public: else { m_line_editor.handle_key(key); - m_current_completion = -1; - if (context().has_ui()) - context().ui().menu_hide(); + clear_completions(); showcompl = true; } @@ -502,6 +506,13 @@ private: } catch (runtime_error&) {} } + void clear_completions() + { + m_current_completion = -1; + if (context().has_ui()) + context().ui().menu_hide(); + } + void display() const { auto display_line = m_line_editor.build_display_line();