Cleanup history_push function

This commit is contained in:
Maxime Coste 2016-08-22 20:19:27 +01:00
parent 56a7c6e594
commit ac81d0f39c

View File

@ -881,12 +881,10 @@ private:
static void history_push(History& history, StringView entry) static void history_push(History& history, StringView entry)
{ {
if(entry.empty() or is_horizontal_blank(entry[0_byte])) if(entry.empty() or is_horizontal_blank(entry[0_byte]))
{
return; return;
}
History::iterator it; history.erase(std::remove(history.begin(), history.end(), entry),
while ((it = find(history, entry)) != history.end()) history.end());
history.erase(it);
history.push_back(entry.str()); history.push_back(entry.str());
} }
}; };