fix another Vector.tabulate bug (else if statement starting from line 473)
This commit is contained in:
@@ -413,6 +413,7 @@ struct
|
|||||||
(* If we can join newString/lines with sub1 while
|
(* If we can join newString/lines with sub1 while
|
||||||
* staying in limit. *)
|
* staying in limit. *)
|
||||||
let
|
let
|
||||||
|
(* VERIFIED TO WORK *)
|
||||||
val _ = print "line 416\n\n\n"
|
val _ = print "line 416\n\n\n"
|
||||||
val _ = print
|
val _ = print
|
||||||
("vector length: " ^ Int.toString (Vector.length newLines) ^ "\n")
|
("vector length: " ^ Int.toString (Vector.length newLines) ^ "\n")
|
||||||
@@ -474,30 +475,41 @@ struct
|
|||||||
(* 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
|
||||||
val _ = print "line 292\n"
|
(* VERIFIED TO WORK *)
|
||||||
(*
|
val _ = print "line 478\n"
|
||||||
val newLeftLines = VectorSlice.slice (leftLinesHd, 0, SOME midpoint)
|
val newLeftLines =
|
||||||
val newLeftLines = VectorSlice.vector newLeftLines
|
if midpoint >= 0 andalso Vector.length leftLinesHd > 0 then
|
||||||
|
let
|
||||||
|
val newLeftLines = VectorSlice.slice
|
||||||
|
(leftLinesHd, 0, SOME (midpoint + 1))
|
||||||
|
in
|
||||||
|
VectorSlice.vector newLeftLines
|
||||||
|
end
|
||||||
|
else
|
||||||
|
Vector.fromList []
|
||||||
|
|
||||||
val newRightLines =
|
val newRightLines =
|
||||||
Vector.tabulate
|
Vector.tabulate
|
||||||
( (Vector.length leftLinesHd - midpoint)
|
( (Vector.length leftLinesHd - Vector.length newLeftLines)
|
||||||
+ Vector.length newLines
|
+ Vector.length newLines
|
||||||
, fn idx =>
|
, fn idx =>
|
||||||
if idx < Vector.length newLines then
|
if idx < Vector.length newLines then
|
||||||
Vector.sub (newLines, idx)
|
Vector.sub (newLines, idx)
|
||||||
else
|
else
|
||||||
(Vector.sub (leftLinesHd, idx - Vector.length newLines)
|
Vector.sub
|
||||||
- String.size strSub1) + String.size newString
|
( leftLinesHd
|
||||||
) *)
|
, (idx - Vector.length newLines)
|
||||||
|
+ Vector.length newLeftLines
|
||||||
|
) - String.size strSub1 + String.size newString
|
||||||
|
)
|
||||||
in
|
in
|
||||||
verifyReturn
|
verifyReturn
|
||||||
{ idx = prevIdx + String.size strSub1
|
{ idx = prevIdx + String.size strSub1
|
||||||
, line = (curLine - Vector.length leftLinesHd) + midpoint
|
, line = (curLine - Vector.length leftLinesHd) + midpoint
|
||||||
, leftStrings = strSub1 :: leftStringsTl
|
, leftStrings = strSub1 :: leftStringsTl
|
||||||
, leftLines = countLineBreaks strSub1 :: leftLinesTl
|
, leftLines = newLeftLines :: leftLinesTl
|
||||||
, rightStrings = (newString ^ strSub2) :: rightStrings
|
, rightStrings = (newString ^ strSub2) :: rightStrings
|
||||||
, rightLines = countLineBreaks (newString ^ strSub2) :: rightLines
|
, rightLines = newRightLines :: rightLines
|
||||||
}
|
}
|
||||||
end
|
end
|
||||||
else
|
else
|
||||||
|
|||||||
Reference in New Issue
Block a user