amend a bug to do wth building wrong string output in line_gap.sml

This commit is contained in:
2024-07-19 19:57:57 +01:00
parent 34139e616b
commit 05e3f3e2db
2 changed files with 22 additions and 6 deletions

View File

@@ -1084,11 +1084,18 @@ struct
let let
(* Delete part of string. *) (* Delete part of string. *)
val newStrStart = finish - moveIdx val newStrStart = finish - moveIdx
val _ = println
("old len = " ^ Int.toString (String.size rightStringsHd))
val _ = println
("new len = "
^ Int.toString (String.size rightStringsHd - newStrStart))
val newStr = String.substring val newStr = String.substring
( rightStringsHd ( rightStringsHd
, newStrStart , newStrStart
, String.size rightStringsHd - newStrStart , String.size rightStringsHd - newStrStart
) )
val _ = println
("actual len = " ^ Int.toString (String.size newStr))
(* Delete from line vector if we need to. *) (* Delete from line vector if we need to. *)
val newLines = val newLines =
@@ -1436,14 +1443,15 @@ struct
* will delete rightwards if it needs to, or else terminates. *) * will delete rightwards if it needs to, or else terminates. *)
let let
val _ = println "1373" val _ = println "1373"
val _ = println ("1444 = " ^ Int.toString (finish - start))
in in
deleteRightFromHere deleteRightFromHere
( curIdx ( nextIdx
, curLine , curLine + Vector.length rightLinesHd
, curIdx , nextIdx
, finish , finish
, leftStrings , rightStringsHd :: leftStrings
, leftLines , rightLinesHd :: leftLines
, rightStringsTl , rightStringsTl
, rightLinesTl , rightLinesTl
) )
@@ -1992,6 +2000,14 @@ struct
if length > 0 then if length > 0 then
let let
val _ = println "deleting..." val _ = println "deleting..."
val _ = println (String.concat
[ "length = "
, Int.toString length
, "| start = "
, Int.toString start
, "| start + length = "
, Int.toString (start + length)
])
in in
del del
( start ( start

View File

@@ -4,7 +4,7 @@ struct
Vector.foldli Vector.foldli
(fn (idx, (pos, delNum, insStr), (rope, gapBuffer)) => (fn (idx, (pos, delNum, insStr), (rope, gapBuffer)) =>
let let
val _ = print ("idx: " ^ Int.toString idx ^ "\n") val _ = print ("txn number: " ^ Int.toString idx ^ "\n")
val oldRope = rope val oldRope = rope
val strSize = String.size insStr val strSize = String.size insStr