From 1f5e9337726eaf20339b1273d86fc7c8eebbea3c Mon Sep 17 00:00:00 2001 From: Humza Shahid Date: Thu, 25 Sep 2025 10:38:57 +0100 Subject: [PATCH] add failing test for 'dk' motion, when cursor is on last character of line --- test/normal-delete.sml | 32 ++++++++++++++++++++++++++++++++ 1 file changed, 32 insertions(+) diff --git a/test/normal-delete.sml b/test/normal-delete.sml index 3355249..1d94001 100644 --- a/test/normal-delete.sml +++ b/test/normal-delete.sml @@ -763,6 +763,38 @@ struct Expect.isTrue (expectedString = actualString andalso expectedIdx = cursorIdx) end) + , test + "deletes second and third lines when cursor is on \ + \last non-newline character of third line" + (fn _ => + let + (* arrange *) + val originalString = "hello\n\nagain\n" + val originalString = + "hello\n\ + \world\n\ + \trello\n\ + \brillo\n" + val originalIdx = 17 + + val app = TestUtils.init originalString + val app = AppWith.idx (app, originalIdx) + + (* act *) + val {buffer, cursorIdx, ...} = TestUtils.updateMany (app, "dk") + + (* assert *) + val expectedString = + "hello\n\ + \brillo\n" + val actualString = LineGap.toString buffer + + val expectedIdx = 6 + val indexIsExpected = true + in + Expect.isTrue + (expectedString = actualString andalso indexIsExpected) + end) ] val tests = [dhDelete, dlDelete, djDelete, ddDelete, dkDelete]