From 600596fbae7a6ac7149263f9f2498cc60742d97a Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?kleines=20Filmr=C3=B6llchen?= Date: Tue, 5 Apr 2022 00:35:15 +0200 Subject: [PATCH] SystemMonitor: Keep current process selection expanded if needed This is a hack until persistent model indices work. --- Userland/Applications/SystemMonitor/main.cpp | 9 +++++++++ 1 file changed, 9 insertions(+) diff --git a/Userland/Applications/SystemMonitor/main.cpp b/Userland/Applications/SystemMonitor/main.cpp index eb2272ebad..4536aa01ea 100644 --- a/Userland/Applications/SystemMonitor/main.cpp +++ b/Userland/Applications/SystemMonitor/main.cpp @@ -408,7 +408,16 @@ ErrorOr serenity_main(Main::Arguments arguments) auto& refresh_timer = window->add( frequency * 1000, [&] { + // FIXME: remove the primitive re-toggling code once persistent model indices work. + auto toggled_indices = process_table_view.selection().indices(); + toggled_indices.remove_all_matching([&](auto const& index) { return !process_table_view.is_toggled(index); }); process_model->update(); + if (!process_table_view.selection().is_empty()) + process_table_view.selection().for_each_index([&](auto& selection) { + if (toggled_indices.contains_slow(selection)) + process_table_view.expand_all_parents_of(selection); + }); + if (auto* memory_stats_widget = SystemMonitor::MemoryStatsWidget::the()) memory_stats_widget->refresh(); });