From b75c96030f9148ecaef5103a94f8a7f26fc7db94 Mon Sep 17 00:00:00 2001 From: haven1433 Date: Tue, 25 Oct 2022 07:17:08 -0500 Subject: [PATCH] use a no-change token when loading map scripts this doesn't need to go in undo/redo. It's more in the 'deferred loading' category. --- src/HexManiac.Core/ViewModels/Map/MapScriptCollection.cs | 9 ++++++--- 1 file changed, 6 insertions(+), 3 deletions(-) diff --git a/src/HexManiac.Core/ViewModels/Map/MapScriptCollection.cs b/src/HexManiac.Core/ViewModels/Map/MapScriptCollection.cs index c6ecab78..0c4781a5 100644 --- a/src/HexManiac.Core/ViewModels/Map/MapScriptCollection.cs +++ b/src/HexManiac.Core/ViewModels/Map/MapScriptCollection.cs @@ -158,13 +158,16 @@ namespace HavenSoft.HexManiac.Core.ViewModels.Map { }); } + // create one-use NoDataChangeDeltaModel tokens rather than using tokens from CurrentChange + // we don't really care for these to be part of undo/redo private void Load() { var model = viewPort.Model; SubScripts.Clear(); + var token = new NoDataChangeDeltaModel(); if (scriptType != 2 && scriptType != 4) { // we're pointing at an XSERun if (model.GetNextRun(address).Start >= address) { - model.ObserveRunWritten(viewPort.ChangeHistory.CurrentChange, new XSERun(address)); + model.ObserveRunWritten(token, new XSERun(address)); } } else { var destination = address; @@ -177,8 +180,8 @@ namespace HavenSoft.HexManiac.Core.ViewModels.Map { destination += 8; } if (!ArrayRun.TryParse(model, "[variable:|h value: pointer<`xse`>]!0000", address, SortedSpan.One(start + 1), out var run).HasError) { - model.ClearFormat(viewPort.ChangeHistory.CurrentChange, run.Start, run.Length); - model.ObserveRunWritten(viewPort.ChangeHistory.CurrentChange, run); + model.ClearFormat(token, run.Start, run.Length); + model.ObserveRunWritten(token, run); } } }