mirror of
https://github.com/Helium314/HeliBoard.git
synced 2025-04-18 13:22:03 +00:00
fix issue that could result in autospace being added before period
This commit is contained in:
parent
b600431af9
commit
c0b14635fd
2 changed files with 4 additions and 7 deletions
|
@ -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");
|
||||
|
|
|
@ -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)
|
||||
|
|
Loading…
Add table
Reference in a new issue