InputHandler: do not put empty lines in history

This commit is contained in:
Maxime Coste 2013-02-19 19:04:36 +01:00
parent 18aac3d4e8
commit c451dd07c6

View File

@ -292,12 +292,14 @@ public:
m_insert_reg = false; m_insert_reg = false;
} }
else if (key == Key{Key::Modifiers::Control, 'm'}) // enter else if (key == Key{Key::Modifiers::Control, 'm'}) // enter
{
if (not line.empty())
{ {
std::vector<String>::iterator it; std::vector<String>::iterator it;
while ((it = find(history, line)) != history.end()) while ((it = find(history, line)) != history.end())
history.erase(it); history.erase(it);
history.push_back(line); history.push_back(line);
}
context().ui().print_status(""); context().ui().print_status("");
context().ui().menu_hide(); context().ui().menu_hide();
reset_normal_mode(); reset_normal_mode();