pass regression test by modifying 'SearchList.backtrackRange' function. The modification that worked was swapping two if-statements around: first we check if the string position is 0 (and loop to check the previous string if so); in the else case, we check if the searchPos <= 1 (which signals for us to exit backtracking). Swapping the order of the if-statements means that, when we exit the loop, we always exit with string that is at this position.
This commit is contained in:
@@ -96,9 +96,7 @@ struct
|
||||
|
||||
fun backtrackRange
|
||||
(pos, hd, absIdx, tl, acc, searchPos, searchString, finish, prevTl) =
|
||||
if searchPos <= 1 then
|
||||
loopRange (pos, hd, absIdx, tl, acc, 0, searchString, finish, prevTl)
|
||||
else if pos < 0 then
|
||||
if pos < 0 then
|
||||
case prevTl of
|
||||
prevHd :: prevTl =>
|
||||
let
|
||||
@@ -119,6 +117,8 @@ struct
|
||||
| [] =>
|
||||
(* Should never be called *)
|
||||
raise Fail "SearchList.backtrackRange error: line 120\n"
|
||||
else if searchPos <= 1 then
|
||||
loopRange (pos, hd, absIdx, tl, acc, 0, searchString, finish, prevTl)
|
||||
else
|
||||
backtrackRange
|
||||
( pos - 1
|
||||
|
||||
@@ -64,10 +64,6 @@ struct
|
||||
|
||||
(* move and then delete twice *)
|
||||
val app = TestUtils.updateMany (app, "edede")
|
||||
|
||||
val s = LineGap.toString (#buffer app)
|
||||
val s = String.toCString s ^ "\n"
|
||||
val () = print s
|
||||
in
|
||||
Expect.isTrue true
|
||||
end)
|
||||
|
||||
Reference in New Issue
Block a user