From 9e604435dab7d5e9a5d56e4b3cfa79bdca0171a3 Mon Sep 17 00:00:00 2001 From: Benjamin Popp Date: Sun, 7 Apr 2019 13:47:04 -0500 Subject: [PATCH] when the find tab finds data in an array, have that line start at the start of the element, not directly with the search results. --- src/HexManiac.Core/ViewModels/ViewPort.cs | 15 +++++++++++++-- 1 file changed, 13 insertions(+), 2 deletions(-) diff --git a/src/HexManiac.Core/ViewModels/ViewPort.cs b/src/HexManiac.Core/ViewModels/ViewPort.cs index 7d9edcb0..899456fe 100644 --- a/src/HexManiac.Core/ViewModels/ViewPort.cs +++ b/src/HexManiac.Core/ViewModels/ViewPort.cs @@ -633,8 +633,19 @@ namespace HavenSoft.HexManiac.Core.ViewModels { public IChildViewPort CreateChildView(int startAddress, int endAddress) { var child = new ChildViewPort(this); - child.Goto.Execute(startAddress.ToString("X2")); - child.SelectionEnd = child.ConvertAddressToViewPoint(endAddress); + + var run = Model.GetNextRun(startAddress); + if (run is ArrayRun array) { + var offsets = array.ConvertByteOffsetToArrayOffset(startAddress); + var lineStart = array.Start + array.ElementLength * offsets.ElementIndex; + child.Goto.Execute(lineStart.ToString("X2")); + child.SelectionStart = child.ConvertAddressToViewPoint(startAddress); + child.SelectionEnd = child.ConvertAddressToViewPoint(endAddress); + } else { + child.Goto.Execute(startAddress.ToString("X2")); + child.SelectionEnd = child.ConvertAddressToViewPoint(endAddress); + } + return child; }