mirror of
https://github.com/Helium314/HeliBoard.git
synced 2025-06-24 18:10:54 +00:00
fix missing auto-space with url detection
caused by bug in nonWordCodePointAndNoSpaceBeforeCursor fixes #229
This commit is contained in:
parent
d47386c745
commit
9975a7d8f6
2 changed files with 16 additions and 2 deletions
|
@ -34,9 +34,9 @@ fun nonWordCodePointAndNoSpaceBeforeCursor(s: CharSequence, spacingAndPunctuatio
|
||||||
space = true
|
space = true
|
||||||
if (!nonWordCodePoint && !spacingAndPunctuations.isWordCodePoint(it))
|
if (!nonWordCodePoint && !spacingAndPunctuations.isWordCodePoint(it))
|
||||||
nonWordCodePoint = true
|
nonWordCodePoint = true
|
||||||
space && nonWordCodePoint
|
space && nonWordCodePoint // stop if both are found
|
||||||
}
|
}
|
||||||
return space && nonWordCodePoint
|
return nonWordCodePoint && !space // return true if an non-word codepoint and no space was found
|
||||||
}
|
}
|
||||||
|
|
||||||
fun hasLetterBeforeLastSpaceBeforeCursor(s: CharSequence): Boolean {
|
fun hasLetterBeforeLastSpaceBeforeCursor(s: CharSequence): Boolean {
|
||||||
|
|
|
@ -463,6 +463,20 @@ class InputLogicTest {
|
||||||
assertEquals("b", composingText)
|
assertEquals("b", composingText)
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Test fun `autospace works in URL field when input isn't URL, also for multiple suggestions`() {
|
||||||
|
reset()
|
||||||
|
DeviceProtectedUtils.getSharedPreferences(latinIME).edit { putBoolean(Settings.PREF_URL_DETECTION, true) }
|
||||||
|
setInputType(InputType.TYPE_CLASS_TEXT or InputType.TYPE_TEXT_VARIATION_URI)
|
||||||
|
pickSuggestion("this")
|
||||||
|
pickSuggestion("is")
|
||||||
|
assertEquals("this is", text)
|
||||||
|
pickSuggestion("not")
|
||||||
|
assertEquals("this is not", text)
|
||||||
|
input('c')
|
||||||
|
assertEquals("this is not c", text)
|
||||||
|
assertEquals("c", composingText)
|
||||||
|
}
|
||||||
|
|
||||||
@Test fun `emoji is added to dictionary`() {
|
@Test fun `emoji is added to dictionary`() {
|
||||||
// check both text and codepoint input
|
// check both text and codepoint input
|
||||||
reset()
|
reset()
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue