diff --git a/app/src/main/java/helium314/keyboard/latin/inputlogic/InputLogic.kt b/app/src/main/java/helium314/keyboard/latin/inputlogic/InputLogic.kt index e2561fdd9..4ead40cfc 100644 --- a/app/src/main/java/helium314/keyboard/latin/inputlogic/InputLogic.kt +++ b/app/src/main/java/helium314/keyboard/latin/inputlogic/InputLogic.kt @@ -1683,11 +1683,7 @@ class InputLogic( } mWordComposer.reset() mConnection.finishComposingText() - mConnection.commitText("", 1) resetComposingState(true) - mSuggestionStripViewAccessor.setNeutralSuggestionStrip() - mLatinIME.feedbackForDeletedWord() - return } val textBefore = mConnection.getTextBeforeCursor(BACKSPACE_WORD_LOOKBACK, 0)?.toString() diff --git a/app/src/test/java/helium314/keyboard/latin/InputLogicTest.kt b/app/src/test/java/helium314/keyboard/latin/InputLogicTest.kt index 912e6a1a0..caf136758 100644 --- a/app/src/test/java/helium314/keyboard/latin/InputLogicTest.kt +++ b/app/src/test/java/helium314/keyboard/latin/InputLogicTest.kt @@ -1687,6 +1687,30 @@ class InputLogicTest { assertEquals("ein", text) // with word deletion, "eins" would be gone completely } + @Test fun `delete word swipe deletes the composing word`() { + reset() + setText("hello ") + chainInput("there") + assertEquals("there", composingText) + inputLogic.deleteWordBeforeCursor() + handleMessages() + checkConnectionConsistency() + assertEquals("hello ", text) + assertEquals("", composingText) + } + + @Test fun `delete word swipe inside a composing word deletes up to the cursor`() { + reset() + setText("hello there") + setCursorPosition(8) // after h in there + assertEquals("there", composingText) + inputLogic.deleteWordBeforeCursor() + handleMessages() + checkConnectionConsistency() + assertEquals("hello ere", text) + assertEquals(6, cursor) + } + @Test fun timestamp() { reset() chainInput("hello")