From a28e099b6f9d358390d4207b14265594943ad290 Mon Sep 17 00:00:00 2001 From: Humza Shahid Date: Thu, 16 Oct 2025 13:22:34 +0100 Subject: [PATCH] add another test for 'd^' motion, that we don't delete anything when cursor is on a newline (this one passes but it is an important case to test) --- test/normal-delete.sml | 21 +++++++++++++++++++++ 1 file changed, 21 insertions(+) diff --git a/test/normal-delete.sml b/test/normal-delete.sml index 03b6cd2..34ff97f 100644 --- a/test/normal-delete.sml +++ b/test/normal-delete.sml @@ -3229,6 +3229,27 @@ struct (actualString = expectedString andalso cursorIdx = expectedCursorIdx) end) + , test + "does not delete from buffer or move cursor when cursor is on newline" + (fn _ => + let + (* arrange *) + val originalString = "hello\n\nworld\n" + val app = TestUtils.init originalString + val app = AppWith.idx (app, 6) + + (* act *) + val {buffer, cursorIdx, ...} = TestUtils.updateMany (app, "d^") + + (* assert *) + val actualString = LineGap.toString buffer + val expectedString = originalString + val expectedCursorIdx = 6 + in + Expect.isTrue + (actualString = expectedString + andalso cursorIdx = expectedCursorIdx) + end) ] val tests =