mirror of
https://github.com/SchildiChat/SchildiChat-android.git
synced 2025-03-15 18:59:12 +03:00
Use cursor position instead of error-prone autocompletion detection
Change-Id: Id93f5ba4d63bff00835ad7738550851e94fcbf7c
This commit is contained in:
parent
20081e8806
commit
a8ac1ebc60
1 changed files with 6 additions and 0 deletions
|
@ -184,10 +184,13 @@ class AutoCompleter @AssistedInject constructor(
|
|||
}
|
||||
|
||||
// Detect next word separator
|
||||
/*
|
||||
var endIndex = editable.indexOf(" ", startIndex)
|
||||
if (endIndex == -1) {
|
||||
endIndex = editable.length
|
||||
}
|
||||
*/
|
||||
val endIndex = editText.selectionEnd
|
||||
|
||||
// Replace the word by its completion
|
||||
editable.delete(startIndex, endIndex)
|
||||
|
@ -227,10 +230,13 @@ class AutoCompleter @AssistedInject constructor(
|
|||
}
|
||||
|
||||
// Detect next word separator
|
||||
/*
|
||||
var endIndex = editable.indexOfAny(listOf(" ", "\n"), startIndex)
|
||||
if (endIndex == -1) {
|
||||
endIndex = editable.length
|
||||
}
|
||||
*/
|
||||
val endIndex = editText.selectionEnd
|
||||
|
||||
// Replace the word by its completion
|
||||
val displayName = matrixItem.getBestName()
|
||||
|
|
Loading…
Add table
Reference in a new issue