fix prompt completion handling misbehaving with history

This commit is contained in:
Maxime Coste 2013-11-28 18:44:42 +00:00
parent b83414ddf7
commit 50325e62b0

View File

@ -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();