mirror of
https://github.com/Helium314/HeliBoard.git
synced 2025-04-20 06:09:09 +00:00
disable undo-like functionality for textInput, fixes #1019
This commit is contained in:
parent
73988394a9
commit
f2a46cfa9a
2 changed files with 35 additions and 1 deletions
|
@ -1212,7 +1212,12 @@ public final class InputLogic {
|
|||
}
|
||||
return;
|
||||
}
|
||||
if (mEnteredText != null && mConnection.sameAsTextBeforeCursor(mEnteredText)) {
|
||||
// todo: this is currently disabled, as it causes inconsistencies with textInput, depending whether the end
|
||||
// is part of a word (where we start composing) or not (where we end in code below)
|
||||
// see https://github.com/Helium314/HeliBoard/issues/1019
|
||||
// with better emoji detection on backspace (getFullEmojiAtEnd), this functionality might not be necessary
|
||||
// -> enable again if there are issues, otherwise delete the code, together with mEnteredText
|
||||
if (false && mEnteredText != null && mConnection.sameAsTextBeforeCursor(mEnteredText)) {
|
||||
// Cancel multi-character input: remove the text we just entered.
|
||||
// This is triggered on backspace after a key that inputs multiple characters,
|
||||
// like the smiley key or the .com key.
|
||||
|
|
|
@ -613,6 +613,35 @@ class InputLogicTest {
|
|||
assertEquals("{\"label\": \"c", text)
|
||||
}
|
||||
|
||||
@Test fun `text input and delete`() {
|
||||
reset()
|
||||
input("hello")
|
||||
assertEquals("hello", text)
|
||||
functionalKeyPress(KeyCode.DELETE)
|
||||
assertEquals("hell", text)
|
||||
|
||||
reset()
|
||||
input("hello ")
|
||||
assertEquals("hello ", text)
|
||||
functionalKeyPress(KeyCode.DELETE)
|
||||
assertEquals("hello", text)
|
||||
}
|
||||
|
||||
@Test fun `emoji text input and delete`() {
|
||||
reset()
|
||||
input("🕵🏼")
|
||||
functionalKeyPress(KeyCode.DELETE)
|
||||
assertEquals("", text)
|
||||
|
||||
reset()
|
||||
input("\uD83D\uDD75\uD83C\uDFFC")
|
||||
input(' ')
|
||||
assertEquals("🕵🏼 ", text)
|
||||
functionalKeyPress(KeyCode.DELETE)
|
||||
functionalKeyPress(KeyCode.DELETE)
|
||||
assertEquals("", text)
|
||||
}
|
||||
|
||||
// ------- helper functions ---------
|
||||
|
||||
// should be called before every test, so the same state is guaranteed
|
||||
|
|
Loading…
Add table
Reference in a new issue