mirror of
https://github.com/Helium314/HeliBoard.git
synced 2025-04-19 21:59:11 +00:00
improve situation when local state is out of sync with editor
related to / found during tests for 6100186f73
This commit is contained in:
parent
6100186f73
commit
d08afcd279
1 changed files with 7 additions and 0 deletions
|
@ -653,6 +653,9 @@ public final class RichInputConnection implements PrivateCommandPerformer {
|
|||
final CharSequence textBeforeCursor =
|
||||
getTextBeforeCursor(Constants.EDITOR_CONTENTS_CACHE_SIZE + (end - start), 0);
|
||||
mCommittedTextBeforeComposingText.setLength(0);
|
||||
// also clear composing text, otherwise we may append existing text
|
||||
// this can happen when we're a little out of sync with the editor
|
||||
mComposingText.setLength(0);
|
||||
if (!TextUtils.isEmpty(textBeforeCursor)) {
|
||||
// The cursor is not necessarily at the end of the composing text, but we have its
|
||||
// position in mExpectedSelStart and mExpectedSelEnd. In this case we want the start
|
||||
|
@ -949,6 +952,10 @@ public final class RichInputConnection implements PrivateCommandPerformer {
|
|||
// If what's after the cursor is a word character, then we're touching a word.
|
||||
return true;
|
||||
}
|
||||
if (mComposingText.length() > 0) {
|
||||
// a composing region should always count as a word
|
||||
return true;
|
||||
}
|
||||
final String textBeforeCursor = mCommittedTextBeforeComposingText.toString();
|
||||
int indexOfCodePointInJavaChars = textBeforeCursor.length();
|
||||
int consideredCodePoint = 0 == indexOfCodePointInJavaChars ? Constants.NOT_A_CODE
|
||||
|
|
Loading…
Add table
Reference in a new issue