amend 'dw' motion in line with previous commit
This commit is contained in:
@@ -944,30 +944,27 @@ struct
|
||||
in
|
||||
Expect.isTrue (stringsAreExpected andalso cursorsAreExpected)
|
||||
end)
|
||||
, test
|
||||
"deletes newline when there is a newline after current word \
|
||||
\and there is another word following that newline"
|
||||
(fn _ =>
|
||||
let
|
||||
(* arrange *)
|
||||
val originalString = "hello\nworld\nagain\n"
|
||||
val app = TestUtils.init originalString
|
||||
val app = AppWith.idx (app, 1)
|
||||
, test "does not delete newline following word" (fn _ =>
|
||||
let
|
||||
(* arrange *)
|
||||
val originalString = "hello\nworld\nagain\n"
|
||||
val app = TestUtils.init originalString
|
||||
val app = AppWith.idx (app, 0)
|
||||
|
||||
(* act *)
|
||||
val {buffer, cursorIdx, ...} = TestUtils.updateMany (app, "dw")
|
||||
(* act *)
|
||||
val {buffer, cursorIdx, ...} = TestUtils.updateMany (app, "dw")
|
||||
|
||||
(* assert *)
|
||||
val expectedString = "hworld\nagain\n"
|
||||
val expectedCursor = 1
|
||||
(* assert *)
|
||||
val expectedString = "\nworld\nagain\n"
|
||||
val expectedCursor = 0
|
||||
|
||||
val actualString = LineGap.toString buffer
|
||||
val actualString = LineGap.toString buffer
|
||||
|
||||
val stringIsExpected = expectedString = actualString
|
||||
val cursorIsExpected = expectedCursor = cursorIdx
|
||||
in
|
||||
Expect.isTrue (stringIsExpected andalso cursorIsExpected)
|
||||
end)
|
||||
val stringIsExpected = expectedString = actualString
|
||||
val cursorIsExpected = expectedCursor = cursorIdx
|
||||
in
|
||||
Expect.isTrue (stringIsExpected andalso cursorIsExpected)
|
||||
end)
|
||||
, test
|
||||
"deletes until first punctuation char when on an alpha char \
|
||||
\and there is no space between alpha and punctuation"
|
||||
|
||||
@@ -754,6 +754,18 @@ struct
|
||||
(* assert *)
|
||||
Expect.isTrue (#cursorIdx app = 4)
|
||||
end)
|
||||
, test "moves cursor to character after newline" (fn _ =>
|
||||
let
|
||||
(* arrange *)
|
||||
val app = TestUtils.init "hello\nworld\nagain\n"
|
||||
val app = AppWith.idx (app, 0)
|
||||
|
||||
(* act *)
|
||||
val app = TestUtils.update (app, CHAR_EVENT #"w")
|
||||
in
|
||||
(* assert *)
|
||||
Expect.isTrue (#cursorIdx app = 6)
|
||||
end)
|
||||
]
|
||||
|
||||
val WMove = describe "move motion 'W'"
|
||||
|
||||
Reference in New Issue
Block a user