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:
@@ -224,9 +224,23 @@ 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 *)
|
||||||
Fn.fStart
|
if strIdx < 0 then
|
||||||
(strIdx, strHd, lnHd, cursorIdx, leftStrings, leftLines, env)
|
case (leftStrings, leftLines) of
|
||||||
|
(lshd :: lstl, llhd :: lltl) =>
|
||||||
|
Fn.fStart
|
||||||
|
( String.size lshd - 1
|
||||||
|
, lshd
|
||||||
|
, llhd
|
||||||
|
, cursorIdx
|
||||||
|
, lstl
|
||||||
|
, lltl
|
||||||
|
, env
|
||||||
|
)
|
||||||
|
| (_, _) => 0
|
||||||
|
else
|
||||||
|
Fn.fStart
|
||||||
|
(strIdx, strHd, lnHd, cursorIdx, leftStrings, leftLines, env)
|
||||||
else
|
else
|
||||||
(* strIdx must be in the strTl *)
|
(* strIdx must be in the strTl *)
|
||||||
(case (strTl, lnTl) of
|
(case (strTl, lnTl) of
|
||||||
|
|||||||
Reference in New Issue
Block a user