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

BIN
shf

Binary file not shown.

View File

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