after amending a few more bugs, it seems that line metadata and index metadata are handled correctly. At least for svelte dataset; worth checking others as well
This commit is contained in:
@@ -1268,7 +1268,9 @@ struct
|
|||||||
val lineDeleteEnd = binSearch
|
val lineDeleteEnd = binSearch
|
||||||
(String.size newString - 1, rightLinesHd)
|
(String.size newString - 1, rightLinesHd)
|
||||||
val newLines =
|
val newLines =
|
||||||
if lineDeleteEnd >= 0 then
|
if Vector.length rightLinesHd = 0 orelse lineDeleteEnd < 0 then
|
||||||
|
Vector.fromList []
|
||||||
|
else
|
||||||
let
|
let
|
||||||
val _ = println "1141"
|
val _ = println "1141"
|
||||||
val slice = VectorSlice.slice
|
val slice = VectorSlice.slice
|
||||||
@@ -1276,8 +1278,7 @@ struct
|
|||||||
in
|
in
|
||||||
VectorSlice.vector slice
|
VectorSlice.vector slice
|
||||||
end
|
end
|
||||||
else
|
|
||||||
Vector.fromList []
|
|
||||||
val nextLine = curLine + Vector.length newLines
|
val nextLine = curLine + Vector.length newLines
|
||||||
in
|
in
|
||||||
(* Try joining new string with left head if possible. *)
|
(* Try joining new string with left head if possible. *)
|
||||||
@@ -1332,8 +1333,8 @@ struct
|
|||||||
val _ = println "1264"
|
val _ = println "1264"
|
||||||
in
|
in
|
||||||
deleteRightFromHere
|
deleteRightFromHere
|
||||||
( nextIdx
|
( curIdx + String.size newString
|
||||||
, nextLine
|
, curLine + Vector.length newLines
|
||||||
, nextIdx
|
, nextIdx
|
||||||
, finish
|
, finish
|
||||||
, newString :: leftStrings
|
, newString :: leftStrings
|
||||||
@@ -1718,15 +1719,18 @@ struct
|
|||||||
)
|
)
|
||||||
val newLines =
|
val newLines =
|
||||||
let
|
let
|
||||||
val midpoint = binSearch
|
val midpoint = forwardBinSearch (stringStart, leftLinesHd)
|
||||||
(String.size newString - 1, leftLinesHd)
|
|
||||||
in
|
in
|
||||||
if midpoint >= 0 then
|
if midpoint >= 0 then
|
||||||
let
|
let
|
||||||
val _ = println "1640"
|
val _ = println "1640"
|
||||||
in
|
in
|
||||||
Vector.tabulate (midpoint, fn idx =>
|
Vector.tabulate
|
||||||
Vector.sub (leftLinesHd, idx + 1) - stringStart)
|
( Vector.length leftLinesHd - midpoint
|
||||||
|
, fn idx =>
|
||||||
|
Vector.sub (leftLinesHd, idx + midpoint)
|
||||||
|
- stringStart
|
||||||
|
)
|
||||||
end
|
end
|
||||||
else
|
else
|
||||||
Vector.fromList []
|
Vector.fromList []
|
||||||
|
|||||||
@@ -16,6 +16,10 @@ struct
|
|||||||
val gapBuffer =
|
val gapBuffer =
|
||||||
if delNum > 0 then LineGap.delete (pos, delNum, gapBuffer)
|
if delNum > 0 then LineGap.delete (pos, delNum, gapBuffer)
|
||||||
else gapBuffer
|
else gapBuffer
|
||||||
|
|
||||||
|
val _ = LineGap.verifyIndex gapBuffer
|
||||||
|
val _ = LineGap.verifyLines gapBuffer
|
||||||
|
|
||||||
val gapBuffer =
|
val gapBuffer =
|
||||||
if strSize > 0 then LineGap.insert (pos, insStr, gapBuffer)
|
if strSize > 0 then LineGap.insert (pos, insStr, gapBuffer)
|
||||||
else gapBuffer
|
else gapBuffer
|
||||||
|
|||||||
Reference in New Issue
Block a user