fix minor bug in make-dfa-loop.sml: when folding backwards using an if-statement, make sure we start folding from the leftStrings if the cursorIdx < 0

This commit is contained in:
2025-09-25 08:34:23 +01:00
parent 5264cbfac8
commit 0255b127a7

View File

@@ -224,7 +224,21 @@ struct
val strIdx = cursorIdx - bufferIdx val strIdx = cursorIdx - bufferIdx
in in
if strIdx < String.size strHd then if strIdx < String.size strHd then
(* strIdx is in this string *) (* strIdx is either in this string or in leftStrings *)
if strIdx < 0 then
case (leftStrings, leftLines) of
(lshd :: lstl, llhd :: lltl) =>
Fn.fStart
( String.size lshd - 1
, lshd
, llhd
, cursorIdx
, lstl
, lltl
, env
)
| (_, _) => 0
else
Fn.fStart Fn.fStart
(strIdx, strHd, lnHd, cursorIdx, leftStrings, leftLines, env) (strIdx, strHd, lnHd, cursorIdx, leftStrings, leftLines, env)
else else