Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -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()
Expand Down
24 changes: 24 additions & 0 deletions app/src/test/java/helium314/keyboard/latin/InputLogicTest.kt
Original file line number Diff line number Diff line change
Expand Up @@ -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")
Expand Down
Loading