diff --git a/temp.txt b/temp.txt index caa79a8..5b42468 100644 --- a/temp.txt +++ b/temp.txt @@ -1 +1 @@ -hello!world!again\ +hello again diff --git a/test/normal-delete.sml b/test/normal-delete.sml index ce74399..2b5437d 100644 --- a/test/normal-delete.sml +++ b/test/normal-delete.sml @@ -2435,6 +2435,54 @@ struct val actualString = LineGap.toString buffer + val stringIsExpected = expectedString = actualString + val cursorIsExpected = expectedCursor = cursorIdx + in + Expect.isTrue (stringIsExpected andalso cursorIsExpected) + end) + , test + "deletes only one punctuation char when on an alpha char \ + \which is preceded by punctuation" + (fn _ => + let + (* arrange *) + val originalString = "!#%&(hello\n" + val app = TestUtils.init originalString + val app = AppWith.idx (app, 7) + + (* act *) + val {buffer, cursorIdx, ...} = TestUtils.updateMany (app, "dge") + + (* assert *) + val expectedString = "!#%&lo\n" + val expectedCursor = 4 + + val actualString = LineGap.toString buffer + + val stringIsExpected = expectedString = actualString + val cursorIsExpected = expectedCursor = cursorIdx + in + Expect.isTrue (stringIsExpected andalso cursorIsExpected) + end) + , test + "deletes spaces until reaching non-space char, \ + \when cursor is on space and is preceded by more spaces" + (fn _ => + let + (* arrange *) + val originalString = "hello again\n" + val app = TestUtils.init originalString + val app = AppWith.idx (app, 13) + + (* act *) + val {buffer, cursorIdx, ...} = TestUtils.updateMany (app, "dge") + + (* assert *) + val expectedString = "hell again\n" + val expectedCursor = 4 + + val actualString = LineGap.toString buffer + val stringIsExpected = expectedString = actualString val cursorIsExpected = expectedCursor = cursorIdx in