Use cursor position instead of error-prone autocompletion detection
Change-Id: Id93f5ba4d63bff00835ad7738550851e94fcbf7c
This commit is contained in:
parent
20081e8806
commit
a8ac1ebc60
@ -184,10 +184,13 @@ class AutoCompleter @AssistedInject constructor(
|
|||||||
}
|
}
|
||||||
|
|
||||||
// Detect next word separator
|
// Detect next word separator
|
||||||
|
/*
|
||||||
var endIndex = editable.indexOf(" ", startIndex)
|
var endIndex = editable.indexOf(" ", startIndex)
|
||||||
if (endIndex == -1) {
|
if (endIndex == -1) {
|
||||||
endIndex = editable.length
|
endIndex = editable.length
|
||||||
}
|
}
|
||||||
|
*/
|
||||||
|
val endIndex = editText.selectionEnd
|
||||||
|
|
||||||
// Replace the word by its completion
|
// Replace the word by its completion
|
||||||
editable.delete(startIndex, endIndex)
|
editable.delete(startIndex, endIndex)
|
||||||
@ -227,10 +230,13 @@ class AutoCompleter @AssistedInject constructor(
|
|||||||
}
|
}
|
||||||
|
|
||||||
// Detect next word separator
|
// Detect next word separator
|
||||||
|
/*
|
||||||
var endIndex = editable.indexOfAny(listOf(" ", "\n"), startIndex)
|
var endIndex = editable.indexOfAny(listOf(" ", "\n"), startIndex)
|
||||||
if (endIndex == -1) {
|
if (endIndex == -1) {
|
||||||
endIndex = editable.length
|
endIndex = editable.length
|
||||||
}
|
}
|
||||||
|
*/
|
||||||
|
val endIndex = editText.selectionEnd
|
||||||
|
|
||||||
// Replace the word by its completion
|
// Replace the word by its completion
|
||||||
val displayName = matrixItem.getBestName()
|
val displayName = matrixItem.getBestName()
|
||||||
|
Loading…
x
Reference in New Issue
Block a user