Skip to content

Commit

Permalink
Filter empty entries when restoring HistoryRegisters
Browse files Browse the repository at this point in the history
Saving registers will create a single empty entry due to the way
StaticRegister::get works. We do not really want those to be restored
  • Loading branch information
mawww committed Jun 7, 2022
1 parent 34e1f3c commit a88d80a
Showing 1 changed file with 5 additions and 1 deletion.
6 changes: 5 additions & 1 deletion src/register_manager.cc
Original file line number Diff line number Diff line change
Expand Up @@ -34,7 +34,11 @@ void HistoryRegister::set(Context& context, ConstArrayView<String> values, bool
constexpr size_t size_limit = 100;

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)
{
Expand Down

0 comments on commit a88d80a

Please sign in to comment.