Filter empty entries when restoring HistoryRegisters

Saving registers will create a single empty entry due to the way
StaticRegister::get works. We do not really want those to be restored
This commit is contained in:
Maxime Coste 2022-06-07 13:59:02 +10:00
parent 34e1f3cc1b
commit a88d80a432

View File

@ -34,7 +34,11 @@ void HistoryRegister::set(Context& context, ConstArrayView<String> values, bool
constexpr size_t size_limit = 100; constexpr size_t size_limit = 100;
if (restoring) if (restoring)
return StaticRegister::set(context, values, true); {
StaticRegister::set(context, values, true);
m_content.erase(remove_if(m_content, [](auto&& s) { return s.empty(); }), m_content.end());
return;
}
for (auto& entry : values) for (auto& entry : values)
{ {