Skip to content

Commit 1fcafa5

Browse files
NeWbY100claude
andcommitted
fix: clear all-match highlights when no matches exist
UpdateHexMatchRanges previously assigned an empty List<HexMatchRange> when FindAll returned nothing, which the change-tracking and DP binding occasionally treated as a no-op vs. the prior non-empty list, leaving stale highlights on screen. Set HexMatchRanges = null explicitly on no-match. Also clear when the search box is emptied or the pattern fails to parse during live typing. Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
1 parent 703bbe4 commit 1fcafa5

1 file changed

Lines changed: 8 additions & 0 deletions

File tree

ReScene.NET/ViewModels/InspectorViewModel.cs

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1097,6 +1097,7 @@ private void RunLiveHexSearch()
10971097
if (string.IsNullOrWhiteSpace(HexSearchText))
10981098
{
10991099
HexSearchStatus = string.Empty;
1100+
HexMatchRanges = null;
11001101
return;
11011102
}
11021103

@@ -1106,6 +1107,7 @@ private void RunLiveHexSearch()
11061107
{
11071108
// Stay quiet during typing — error message only on explicit Next/Prev.
11081109
HexSearchStatus = string.Empty;
1110+
HexMatchRanges = null;
11091111
return;
11101112
}
11111113

@@ -1156,6 +1158,12 @@ private void UpdateHexMatchRanges(HexSearchPattern? pattern)
11561158
}
11571159

11581160
IReadOnlyList<long> offsets = HexSearcher.FindAll(HexDataSource, pattern);
1161+
if (offsets.Count == 0)
1162+
{
1163+
HexMatchRanges = null;
1164+
return;
1165+
}
1166+
11591167
var ranges = new List<HexMatchRange>(offsets.Count);
11601168
foreach (long offset in offsets)
11611169
{

0 commit comments

Comments
 (0)