LibGUI: Sync the highlighting after each model update

Without this, the highlighting would stay on the initial index even if
the matching row is no longer there.
This commit is contained in:
Dawid Wolosowicz 2021-09-04 15:21:15 +02:00 committed by Ali Mohammad Pur
parent d0e44993a1
commit 8419eef85e

View file

@ -72,6 +72,10 @@ void AbstractView::model_did_update(unsigned int flags)
if (!model()->is_within_range(m_drop_candidate_index))
m_drop_candidate_index = {};
selection().remove_matching([this](auto& index) { return !model()->is_within_range(index); });
auto index = find_next_search_match(m_highlighted_search.view());
if (index.is_valid())
highlight_search(index);
}
m_selection_start_index = {};
}