From 8419eef85e770dc06a94a264b7860832e54c6a96 Mon Sep 17 00:00:00 2001 From: Dawid Wolosowicz Date: Sat, 4 Sep 2021 15:21:15 +0200 Subject: [PATCH] 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. --- Userland/Libraries/LibGUI/AbstractView.cpp | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/Userland/Libraries/LibGUI/AbstractView.cpp b/Userland/Libraries/LibGUI/AbstractView.cpp index fd635eda63a..e98f62669d0 100644 --- a/Userland/Libraries/LibGUI/AbstractView.cpp +++ b/Userland/Libraries/LibGUI/AbstractView.cpp @@ -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 = {}; }