fix another buggy Vector.tabulate case
This commit is contained in:
Binary file not shown.
Binary file not shown.
@@ -814,37 +814,49 @@ struct
|
|||||||
(Vector.length rightLinesHd - midpoint) + Vector.length newLines
|
(Vector.length rightLinesHd - midpoint) + Vector.length newLines
|
||||||
<= vecLimit
|
<= vecLimit
|
||||||
*)
|
*)
|
||||||
false
|
true
|
||||||
then
|
then
|
||||||
(* If we can join newString/line with sub2 while staying
|
(* If we can join newString/line with sub2 while staying
|
||||||
* in limit. *)
|
* in limit. *)
|
||||||
let
|
let
|
||||||
|
(* VERIFIED TO WORK *)
|
||||||
val _ = print "line 581\n"
|
val _ = print "line 581\n"
|
||||||
|
val newLeftLinesHd =
|
||||||
|
if midpoint >= 0 then
|
||||||
|
let
|
||||||
|
val newLeftLinesHd = VectorSlice.slice
|
||||||
|
(rightLinesHd, 0, SOME (midpoint + 1))
|
||||||
|
in
|
||||||
|
VectorSlice.vector newLeftLinesHd
|
||||||
|
end
|
||||||
|
else
|
||||||
|
Vector.fromList []
|
||||||
|
|
||||||
val newRightStringsHd = newString ^ strSub2
|
val newRightStringsHd = newString ^ strSub2
|
||||||
(*
|
|
||||||
val newRightLinesHd =
|
val newRightLinesHd =
|
||||||
Vector.tabulate
|
Vector.tabulate
|
||||||
( Vector.length newLines + Vector.length rightLinesHd - midpoint
|
( (Vector.length newLines + Vector.length rightLinesHd)
|
||||||
, fn idx =>
|
- Vector.length newLeftLinesHd
|
||||||
if idx < Vector.length newLines then
|
, fn idx =>
|
||||||
Vector.sub (newLines, idx)
|
if idx < Vector.length newLines then
|
||||||
else
|
Vector.sub (newLines, idx)
|
||||||
Vector.sub (rightLinesHd, idx - Vector.length newLines)
|
else
|
||||||
+ String.size newString
|
(Vector.sub
|
||||||
)
|
( rightLinesHd
|
||||||
|
, (idx - Vector.length newLines)
|
||||||
val newLeftLinesHd =
|
+ Vector.length newLeftLinesHd
|
||||||
VectorSlice.slice (rightLinesHd, 0, SOME midpoint)
|
) - String.size strSub1) + String.size newString
|
||||||
val newLeftLinesHd = VectorSlice.vector newLeftLinesHd
|
)
|
||||||
*)
|
|
||||||
in
|
in
|
||||||
verifyReturn
|
verifyReturn
|
||||||
{ idx = curIdx + String.size strSub1
|
{ idx = curIdx + String.size strSub1
|
||||||
, line = curLine + Vector.length (countLineBreaks strSub1)
|
, line = curLine + Vector.length newLeftLinesHd
|
||||||
, leftStrings = strSub1 :: leftStrings
|
, leftStrings = strSub1 :: leftStrings
|
||||||
, leftLines = countLineBreaks strSub1 :: leftLines
|
, leftLines = newLeftLinesHd :: leftLines
|
||||||
, rightStrings = newRightStringsHd :: rightStringsTl
|
, rightStrings = newRightStringsHd :: rightStringsTl
|
||||||
, rightLines = countLineBreaks newRightStringsHd :: rightLinesTl
|
, rightLines = newRightLinesHd :: rightLinesTl
|
||||||
}
|
}
|
||||||
end
|
end
|
||||||
else
|
else
|
||||||
@@ -925,7 +937,7 @@ struct
|
|||||||
Vector.sub
|
Vector.sub
|
||||||
(rightLinesHd, idx - Vector.length leftLinesHd)
|
(rightLinesHd, idx - Vector.length leftLinesHd)
|
||||||
+ String.size leftStringsHd
|
+ String.size leftStringsHd
|
||||||
)
|
)
|
||||||
in
|
in
|
||||||
moveRightAndIns
|
moveRightAndIns
|
||||||
( idx
|
( idx
|
||||||
|
|||||||
Reference in New Issue
Block a user