From 6be1d48b023f958f368a558f1d9a1e4a72f9387c Mon Sep 17 00:00:00 2001 From: Humza Shahid Date: Tue, 23 Sep 2025 09:00:50 +0100 Subject: [PATCH] add test for 'k' motion: when file ends with two newlines and cursor is on newline_1 in the pattern (char -> newline_1 -> newline_2), we should be able to move up by a line --- test/normal-move.sml | 18 ++++++++++++++++++ 1 file changed, 18 insertions(+) diff --git a/test/normal-move.sml b/test/normal-move.sml index 3b74dfe..3e245ab 100644 --- a/test/normal-move.sml +++ b/test/normal-move.sml @@ -476,6 +476,24 @@ struct (* assert *) Expect.isTrue (cursorIdx = 0) end) + , test + "when file ends with two newlines, \ + \and cursor is on second-last newline, \ + \we should be able to move up by one line" + (fn _ => + let + (* arrange *) + val str = "hello\nworld\n\n" + + val app = TestUtils.init str + val app = AppWith.idx (app, 11) + + (* act *) + val {cursorIdx, ...} = TestUtils.update (app, CHAR_EVENT #"k") + in + (* assert *) + Expect.isTrue (cursorIdx = 6) + end) ] val wMove = describe "move motion 'w'"