fix tracking of textLength and lineLength fields, which were previously buggy in only one delete branch; the current commit fixes that branch and verifies the tests pass

This commit is contained in:
2025-09-14 15:48:26 +01:00
parent a95e90214d
commit 09fe611efb

View File

@@ -1584,9 +1584,16 @@ struct
else
Vector.fromList []
val newTextLength = String.size sub1 + String.size sub1
val newLineLength =
val newNodeTextLength = String.size sub1 + String.size sub2
val textLengthDifference =
oldNodeTextLength - newNodeTextLength
val newTextLength = textLength - textLengthDifference
val newNodeLineLength =
Vector.length sub1Lines + Vector.length sub2Lines
val lineLengthDifference =
oldNodeLineLength - newNodeLineLength
val newLineLength = lineLength - lineLengthDifference
in
{ idx = curIdx + String.size sub1
, textLength = newTextLength