Prevent blank lines from being stored in history

develop
lethosor 2014-06-17 17:21:30 -04:00
parent 0c144b821d
commit cca605d8b4
1 changed files with 10 additions and 0 deletions

@ -58,6 +58,14 @@ public:
cursor_pos = 0; cursor_pos = 0;
frame = 0; frame = 0;
history_idx = command_history.size(); history_idx = command_history.size();
if (history_idx > 0)
{
if (command_history[history_idx - 1] == "")
{
command_history.pop_back();
history_idx--;
}
}
command_history.push_back(entry); command_history.push_back(entry);
} }
~viewscreen_commandpromptst() ~viewscreen_commandpromptst()
@ -205,6 +213,8 @@ void viewscreen_commandpromptst::feed(std::set<df::interface_key> *events)
parent->feed(events); parent->feed(events);
events->clear(); events->clear();
} }
//if (command_history.size() && !entry.size())
// command_history.pop_back();
return; return;
} }
if (events->count(interface_key::SELECT)) if (events->count(interface_key::SELECT))