add a new test validating that the cursor does not move when cursor is on an empty line

This commit is contained in:
2025-09-07 21:09:20 +01:00
parent 11212430f4
commit a037211763
3 changed files with 21 additions and 2 deletions

View File

@@ -1482,6 +1482,24 @@ struct
(* assert *)
Expect.isTrue (oldIdx = newIdx)
end)
, test "does not move cursor when cursor is on a newline" (fn _ =>
let
(* arrange *)
val buffer = LineGap.fromString "hello\n\nworld\n"
val app = TestUtils.init buffer
val app = AppWith.idx (app, 6)
val oldIdx = #cursorIdx app
(* act *)
val app = TestUtils.update (app, CHAR_EVENT #"$")
val newIdx = #cursorIdx app
val nchr = getChr app
val nchr = Char.toString nchr ^ "\n"
in
(* assert *)
Expect.isTrue (oldIdx = newIdx)
end)
]
val hatMove = describe "move motion '^'"