From 68991ed780cb7bf53e4e7f1896e345fcdf0bf54a Mon Sep 17 00:00:00 2001 From: haven1433 Date: Thu, 27 Nov 2025 15:13:32 -0600 Subject: [PATCH] fix error message --- .../ViewModels/Visitors/CompleteCellEdit.cs | 10 +++++++--- 1 file changed, 7 insertions(+), 3 deletions(-) diff --git a/src/HexManiac.Core/ViewModels/Visitors/CompleteCellEdit.cs b/src/HexManiac.Core/ViewModels/Visitors/CompleteCellEdit.cs index 10f85e8f..8929ca7b 100644 --- a/src/HexManiac.Core/ViewModels/Visitors/CompleteCellEdit.cs +++ b/src/HexManiac.Core/ViewModels/Visitors/CompleteCellEdit.cs @@ -653,7 +653,7 @@ namespace HavenSoft.HexManiac.Core.ViewModels.Visitors { for (int i = format.Source + format.Position; i < run.Start + run.Length; i++) CurrentChange.ChangeData(Model, i, 0xFF); NewCell = new HexElement(0xFF, true, new Braille(format.Source, format.Position, StringDelimeter)); NewDataIndex = memoryLocation + 1; - Model.ObserveRunWritten(CurrentChange,new BrailleRun(Model,run.Start,run.PointerSources)); + Model.ObserveRunWritten(CurrentChange, new BrailleRun(Model, run.Start, run.PointerSources)); } private void CompletePointerEdit() { @@ -698,7 +698,11 @@ namespace HavenSoft.HexManiac.Core.ViewModels.Visitors { NewDataIndex = memoryLocation + 4; } else { - ErrorText = $"Address {destinationValue:X2} is not within the data."; + if (offset == 0) { + ErrorText = $"Address {destinationValue:X2} is not within the data."; + } else { + ErrorText = $"Address {destinationValue:X2}+{offset} is not within the data."; + } } } @@ -918,7 +922,7 @@ namespace HavenSoft.HexManiac.Core.ViewModels.Visitors { } } else if (run is ITableRun array) { var offsets = array.ConvertByteOffsetToArrayOffset(memoryLocation); - while (array.ElementContent[offsets.SegmentIndex].Length < memoryLocation-offsets.SegmentStart+bytes.Count+1) { + while (array.ElementContent[offsets.SegmentIndex].Length < memoryLocation - offsets.SegmentStart + bytes.Count + 1) { memoryLocation--; // move back one byte and edit that one instead } if (bytes.Count.Range().Any(i => Model[memoryLocation + i] == 0xFF)) {