reimplement 'df' motion as per previous commits, and add a new test for 'df' motion to check that cursor does not land on a 'newline following a non-newline' position, after deleting using 'df<char>'

This commit is contained in:
2025-10-18 14:24:16 +01:00
parent 239aaacfc5
commit 5d00da2cbb
3 changed files with 51 additions and 11 deletions

View File

@@ -3576,6 +3576,28 @@ struct
(actualString = expectedString
andalso cursorIdx = expectedCursorIdx)
end)
, test
"moves cursor back by one, when deletion range is \
\from a newline that follows a non-newline char"
(fn _ =>
let
(* arrange *)
val originalString = "hey hello\n"
val app = TestUtils.init originalString
val app = AppWith.idx (app, 3)
(* act *)
val {buffer, cursorIdx, ...} = TestUtils.updateMany (app, "dfo")
(* assert *)
val actualString = LineGap.toString buffer
val expectedString = "hey\n"
val expectedCursorIdx = 2
in
Expect.isTrue
(actualString = expectedString
andalso cursorIdx = expectedCursorIdx)
end)
]
val dtDelete = describe "delete motion 'dt<char>'"