fix bugs in new function for moving cursor upwards, taking care to calculate column different if on first line (where there is no preceding newline) vs any line other than the first

This commit is contained in:
2025-09-19 05:23:20 +01:00
parent 4c1a76ae67
commit 9ec8891ce5
2 changed files with 7 additions and 18 deletions

View File

@@ -303,22 +303,6 @@ struct
in
Expect.isTrue isSkipped
end)
, test "moves to 0 of buffer when on first line" (fn _ =>
let
(* arrange *)
val str = "hello \nworld \ntime to go\n"
val buffer = LineGap.fromString str
val app = TestUtils.init buffer
val app = AppWith.idx (app, 5)
(* act *)
val {cursorIdx, ...} = TestUtils.update (app, CHAR_EVENT #"k")
(* assert *)
val isAtStart = cursorIdx = 0
in
Expect.isTrue isAtStart
end)
, test "leaves cursor at same idx when already at start of buffer" (fn _ =>
let
(* arrange *)