seem to have viK and viJ fixed for the moment, except when I delete from the first or second line with 'x' (deleting from other lines does not seem to make a difference)

This commit is contained in:
2024-11-07 12:59:03 +00:00
parent a35c0803fb
commit a77003e348
3 changed files with 27 additions and 9 deletions

View File

@@ -337,7 +337,13 @@ struct
val lineIdx = Vector.sub (lnHd, 0) val lineIdx = Vector.sub (lnHd, 0)
in in
if lineIdx < strIdx then strIdx - lineIdx if lineIdx < strIdx then strIdx - lineIdx
else helpGetCursorColumn (strIdx, leftStrings, leftLines) else
case (leftStrings, leftLines) of
(lshd :: lstl, llhd :: lltl) =>
helpGetCursorColumn (strIdx + String.size lshd, lstl, lltl)
| (_, _) =>
strIdx + 1
end
end end
else if Vector.length lnHd > 1 then else if Vector.length lnHd > 1 then
let let
@@ -471,21 +477,31 @@ struct
let let
(* convert absolute cursorIdx to idx relative to hd string *) (* convert absolute cursorIdx to idx relative to hd string *)
val strIdx = cursorIdx - bufferIdx val strIdx = cursorIdx - bufferIdx
val lineColumn = getCursorColumn (lineGap, cursorIdx)
in in
if strIdx < String.size strHd then if strIdx < String.size strHd then
(* strIdx is in this string *) (* strIdx is in this string *)
helpViJ let
( strIdx, strHd, cursorIdx val lineColumn =
, lineColumn, lineColumn, false helpGetCursorColumnBranch
, strTl, lnTl, false (strIdx, strHd, lnHd, leftStrings, leftLines)
) in
helpViJ
( strIdx, strHd, cursorIdx
, lineColumn, lineColumn, false
, strTl, lnTl, false
)
end
else else
(* strIdx must be in the strTl *) (* strIdx must be in the strTl *)
(case (strTl, lnTl) of (case (strTl, lnTl) of
(nestStrHd :: nestStrTl, nestLnHd :: nestLnTl) => (nestStrHd :: nestStrTl, nestLnHd :: nestLnTl) =>
let let
val strIdx = strIdx - String.size strHd val strIdx = strIdx - String.size strHd
val leftStrings = strHd :: leftStrings
val leftLines = lnHd :: leftLines
val lineColumn =
helpGetCursorColumnBranch
(strIdx, nestStrHd, nestLnHd, leftStrings, leftLines)
in in
helpViJ helpViJ
( strIdx, nestStrHd, cursorIdx ( strIdx, nestStrHd, cursorIdx
@@ -588,7 +604,9 @@ struct
(* strIdx does not start with \n (* strIdx does not start with \n
* so start viK normally*) * so start viK normally*)
let let
val lineColumn = getCursorColumn (lg, cursorIdx) + 1 val lineColumn =
helpGetCursorColumnBranch
(strIdx, shd, lhd, leftStrings, leftLines) + 1
in in
helpViK helpViK
( strIdx, shd, cursorIdx ( strIdx, shd, cursorIdx

BIN
shf

Binary file not shown.

View File

@@ -1,5 +1,5 @@
signature TEXT_BUILDER = signature TEXT_BUILDER =
sig sig aaron baron carrot durian
(* Prerequisite: LineGap is moved to requested line first. *) (* Prerequisite: LineGap is moved to requested line first. *)
val build: int * int * LineGap.t * int * int val build: int * int * LineGap.t * int * int
-> MailboxType.t list -> MailboxType.t list