add a new test validating that the cursor does not move when cursor is on an empty line
This commit is contained in:
@@ -102,7 +102,6 @@ struct
|
|||||||
if cursorIdx > otherIdx then
|
if cursorIdx > otherIdx then
|
||||||
(* yanking backwards from cursorIdx *)
|
(* yanking backwards from cursorIdx *)
|
||||||
let
|
let
|
||||||
val () = print "272\n"
|
|
||||||
val length = cursorIdx - otherIdx + 1
|
val length = cursorIdx - otherIdx + 1
|
||||||
val buffer = LineGap.goToIdx (otherIdx, buffer)
|
val buffer = LineGap.goToIdx (otherIdx, buffer)
|
||||||
|
|
||||||
|
|||||||
@@ -45,13 +45,15 @@ fcore/normal-mode/normal-search-finish.sml
|
|||||||
fcore/move.sml
|
fcore/move.sml
|
||||||
|
|
||||||
fcore/normal-mode/normal-move.sml
|
fcore/normal-mode/normal-move.sml
|
||||||
|
fcore/normal-mode/normal-yank.sml
|
||||||
|
fcore/normal-mode/make-normal-delete.sml
|
||||||
fcore/normal-mode/normal-delete.sml
|
fcore/normal-mode/normal-delete.sml
|
||||||
|
fcore/normal-mode/normal-yank-delete.sml
|
||||||
fcore/normal-mode/normal-mode.sml
|
fcore/normal-mode/normal-mode.sml
|
||||||
fcore/normal-mode/normal-search-mode.sml
|
fcore/normal-mode/normal-search-mode.sml
|
||||||
|
|
||||||
fcore/app-update.sml
|
fcore/app-update.sml
|
||||||
|
|
||||||
|
|
||||||
(* TEST FILES *)
|
(* TEST FILES *)
|
||||||
$(SML_LIB)/basis/mlton.mlb
|
$(SML_LIB)/basis/mlton.mlb
|
||||||
shell/exception-logger.sml
|
shell/exception-logger.sml
|
||||||
|
|||||||
@@ -1482,6 +1482,24 @@ struct
|
|||||||
(* assert *)
|
(* assert *)
|
||||||
Expect.isTrue (oldIdx = newIdx)
|
Expect.isTrue (oldIdx = newIdx)
|
||||||
end)
|
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 '^'"
|
val hatMove = describe "move motion '^'"
|
||||||
|
|||||||
Reference in New Issue
Block a user