diff --git a/app/src/main/java/helium314/keyboard/latin/inputlogic/InputLogic.java b/app/src/main/java/helium314/keyboard/latin/inputlogic/InputLogic.java index b98906ef..cd545d4e 100644 --- a/app/src/main/java/helium314/keyboard/latin/inputlogic/InputLogic.java +++ b/app/src/main/java/helium314/keyboard/latin/inputlogic/InputLogic.java @@ -949,7 +949,9 @@ public final class InputLogic { // TODO: remove isWordConnector() and use isUsuallyFollowedBySpace() instead. // See onStartBatchInput() to see how to do it. if (SpaceState.PHANTOM == inputTransaction.getMSpaceState() - && !settingsValues.isWordConnector(codePoint)) { + && !settingsValues.isWordConnector(codePoint) + && !settingsValues.isUsuallyFollowedBySpace(codePoint) // only relevant in rare cases + ) { if (isComposingWord) { // Sanity check throw new RuntimeException("Should not be composing here"); diff --git a/app/src/test/java/helium314/keyboard/latin/InputLogicTest.kt b/app/src/test/java/helium314/keyboard/latin/InputLogicTest.kt index 4a430ab5..e6aa8095 100644 --- a/app/src/test/java/helium314/keyboard/latin/InputLogicTest.kt +++ b/app/src/test/java/helium314/keyboard/latin/InputLogicTest.kt @@ -203,13 +203,7 @@ class InputLogicTest { assertEquals("example.net", composingText) } - // fails because - // period is not handled with handleSeparatorEvent in this case - // pickSuggestion sets phantom space state - // insertAutomaticSpaceIfOptionsAndTextAllow allows the space - // todo: fix it either in some of those functions, or by finally improving URL detection in a reasonable (and performant) way @Test fun noAutospaceInUrlFieldWhenPickingSuggestion() { - if (BuildConfig.BUILD_TYPE == "runTests") return reset() setInputType(InputType.TYPE_CLASS_TEXT or InputType.TYPE_TEXT_VARIATION_URI) chainInput("exam") @@ -262,6 +256,7 @@ class InputLogicTest { reset() latinIME.prefs().edit { putBoolean(Settings.PREF_URL_DETECTION, true) } latinIME.prefs().edit { putBoolean(Settings.PREF_AUTOSPACE_AFTER_PUNCTUATION, true) } + latinIME.prefs().edit { putBoolean(Settings.PREF_SHIFT_REMOVES_AUTOSPACE, true) } input("bla") input('.') functionalKeyPress(KeyCode.SHIFT) // should remove the phantom space (in addition to normal effect)