From 11212430f42bc3b9aae31a1f9e104d7f5b8f59d8 Mon Sep 17 00:00:00 2001 From: Humza Shahid Date: Sun, 7 Sep 2025 20:59:13 +0100 Subject: [PATCH] fix bug with ViDlrDfa.next: we previously did not consider the case of cursor starts on a line containing nothing but a blank \n newline. We consider this now, returning the same index when it occurs. --- fcore/cursor-dfa/vi-dlr-dfa.sml | 10 +++++++++- 1 file changed, 9 insertions(+), 1 deletion(-) diff --git a/fcore/cursor-dfa/vi-dlr-dfa.sml b/fcore/cursor-dfa/vi-dlr-dfa.sml index f963ef6..b4a9b33 100644 --- a/fcore/cursor-dfa/vi-dlr-dfa.sml +++ b/fcore/cursor-dfa/vi-dlr-dfa.sml @@ -30,7 +30,15 @@ struct val isFinal = isFinal end) - val fStart = Folder.foldNext + fun fStart (idx, absIdx, str, tl, currentState, counter) = + if String.sub (str, idx) = #"\n" then + if counter = 1 then + absIdx + else + Folder.foldNext + (idx + 1, absIdx + 1, str, tl, currentState, counter - 1) + else + Folder.foldNext (idx, absIdx, str, tl, currentState, counter) end) structure ViDlrForDelete =