From 648346e5ba325440406afa73df172ce6bc916421 Mon Sep 17 00:00:00 2001 From: Humza Shahid Date: Sun, 31 Aug 2025 01:33:20 +0100 Subject: [PATCH] fix regression caused by 'TextBuilder.advanceSearchPos' function. We were previously checking if the absIdx is in the search range and advancing based on whether that is true or false, but we should only advance if absIdx is after the search range --- fcore/text-builder.sml | 12 ++++-------- 1 file changed, 4 insertions(+), 8 deletions(-) diff --git a/fcore/text-builder.sml b/fcore/text-builder.sml index 91abde3..0185d55 100644 --- a/fcore/text-builder.sml +++ b/fcore/text-builder.sml @@ -333,14 +333,10 @@ struct end fun advanceSearchPos (absIdx, searchPos, searchHd, searchLen) = - let - val searchIdx = Vector.sub (searchHd, searchPos) - in - if absIdx >= searchIdx andalso absIdx < searchIdx + searchLen then - searchPos - else - searchPos + 1 - end + if isAfterSearchRange (absIdx, searchPos, searchHd, searchLen) then + searchPos + 1 + else + searchPos fun buildTextStringSearch ( pos