From 7e2e60ef4a5ce9b3995e7f1be9fab9fbf4039a18 Mon Sep 17 00:00:00 2001 From: Benjamin Popp Date: Fri, 1 Nov 2019 22:25:34 -0500 Subject: [PATCH] Update anchors pointed to from moved tables This was accidentally removed during the previous refactor. --- src/HexManiac.Core/Models/PokemonModel.cs | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/src/HexManiac.Core/Models/PokemonModel.cs b/src/HexManiac.Core/Models/PokemonModel.cs index 8644b311..af05dc4c 100644 --- a/src/HexManiac.Core/Models/PokemonModel.cs +++ b/src/HexManiac.Core/Models/PokemonModel.cs @@ -493,7 +493,7 @@ namespace HavenSoft.HexManiac.Core.Models { /// Remove the sources that match the array's original location. /// Add new sources corresponding to the array's new location. /// - private void UpdateAnchorsFromArrayMove(ModelDelta changeToken, ArrayRun original, ArrayRun moved) { + private void UpdateAnchorsFromArrayMove(ModelDelta changeToken, ITableRun original, ITableRun moved) { int originalOffset = original.Start; int segmentOffset = moved.Start; // i loops over the different segments in the array @@ -1367,6 +1367,9 @@ namespace HavenSoft.HexManiac.Core.Models { // move run var newRun = run.Duplicate(newStart, run.PointerSources.ToArray()); + if (newRun is ITableRun array) { + UpdateAnchorsFromArrayMove(changeToken, (ITableRun)run, array); + } int index = BinarySearch(run.Start); changeToken.RemoveRun(runs[index]);