From f4bee76023e34d63f8271faac5616ac15b5f58c6 Mon Sep 17 00:00:00 2001 From: Andy McFadden Date: Thu, 19 Aug 2021 14:40:27 -0700 Subject: [PATCH] Update junk counter The bottom of the main window shows the total bytes in the project along with how many are code, data, and junk. The junk figure wasn't updating if you changed a data item to junk or vice-versa, because a simple format change doesn't require reanalyzing the file. To make the counter "live", we need to tell the updater to refresh the values whenever a format changes to or from "junk". --- SourceGen/UndoableChange.cs | 7 +++++++ 1 file changed, 7 insertions(+) diff --git a/SourceGen/UndoableChange.cs b/SourceGen/UndoableChange.cs index 7498350..b1de963 100644 --- a/SourceGen/UndoableChange.cs +++ b/SourceGen/UndoableChange.cs @@ -407,6 +407,13 @@ namespace SourceGen { } else if (oldFormat == null || newFormat == null || oldFormat.Length != newFormat.Length) { uc.ReanalysisRequired = ReanalysisScope.DataOnly; + } else if (oldFormat.FormatType == FormatDescriptor.Type.Junk || + newFormat.FormatType == FormatDescriptor.Type.Junk) { + // If we're changing to or from "junk", we want to redo the analysis + // to regenerate the code/data/junk summary values at the bottom of the + // screen. (Redoing the full analysis is overkill, but I don't think this + // merits a separate flag.) + uc.ReanalysisRequired = ReanalysisScope.DataOnly; } else { uc.ReanalysisRequired = ReanalysisScope.None; }