@@ -58,12 +58,29 @@ void renderHexViewWindow(UiState &uiState, const AppState &appState) {
5858 if (uiState.currentSectorData .empty ()) {
5959 ImGui::Text (" No data available" );
6060 } else {
61+ // Clear highlight cache if sector changed
62+ static size_t lastSectorIndex = SIZE_MAX;
63+ if (lastSectorIndex != uiState.currentSectorIndex ) {
64+ if (appState.hexDisplayFeatureManager ) {
65+ for (auto *feature : appState.hexDisplayFeatureManager ->getFeatures ()) {
66+ feature->highlightCache .clear ();
67+ }
68+ }
69+ lastSectorIndex = uiState.currentSectorIndex ;
70+ }
71+
6172 // Collect highlights from plugins
6273 std::map<size_t , std::pair<uint32_t , int >> highlightMap; // color, priority
6374 if (appState.hexDisplayFeatureManager ) {
6475 for (const auto *feature : appState.hexDisplayFeatureManager ->getFeatures ()) {
6576 if (appState.featureEnabled .count (feature->getName ()) && appState.featureEnabled .at (feature->getName ())) {
66- auto highlights = feature->getHighlights (uiState.currentSectorData , uiState.currentSectorIndex );
77+ std::vector<Highlight> highlights;
78+ if (feature->highlightCache .count (uiState.currentSectorIndex )) {
79+ highlights = feature->highlightCache [uiState.currentSectorIndex ];
80+ } else {
81+ highlights = feature->getHighlights (uiState.currentSectorData , uiState.currentSectorIndex );
82+ feature->highlightCache [uiState.currentSectorIndex ] = highlights;
83+ }
6784 int priority = feature->getPriority ();
6885 for (const auto &h : highlights) {
6986 auto it = highlightMap.find (h.offset );
0 commit comments