simplify one part of cursor.sml's 'startViK' function, by calling 'helpVi0' rather than 'helpViK' when we know previous char is \n

This commit is contained in:
2024-11-07 11:46:30 +00:00
parent 9f0982ad91
commit c07afee77f
2 changed files with 6 additions and 10 deletions

View File

@@ -566,16 +566,12 @@ struct
(* \n -> \n *)
cursorIdx
else
(* non-graphical-chr -> \n *)
let
val lineColumn = getCursorColumn (lg, cursorIdx)
in
helpViK
( strIdx, shd, cursorIdx
, lineColumn, lineColumn, false
, leftStrings, lhd, leftLines
)
end
(* non-graphical-chr -> \n
* Since we know strIdx - 1 is \n
* that means we are at start of line
* so we can simply go to the end of the previous line *)
helpVi0
(strIdx - 2, shd, cursorIdx - 2, leftStrings, leftLines)
else
(* strIdx - 1 is in leftStrings *)
case (leftStrings, leftLines) of

BIN
shf

Binary file not shown.