mirror of
https://github.com/Helium314/HeliBoard.git
synced 2025-05-17 07:22:45 +00:00
fix issue with text being inserted when deleting quicky in joplin (and probably other apps)
This commit is contained in:
parent
d596c028a1
commit
ce30c3b294
1 changed files with 15 additions and 0 deletions
|
@ -449,6 +449,21 @@ public final class RichInputConnection implements PrivateCommandPerformer {
|
||||||
final long startTime = SystemClock.uptimeMillis();
|
final long startTime = SystemClock.uptimeMillis();
|
||||||
final CharSequence result = mIC.getTextBeforeCursor(n, flags);
|
final CharSequence result = mIC.getTextBeforeCursor(n, flags);
|
||||||
detectLaggyConnection(operation, timeout, startTime);
|
detectLaggyConnection(operation, timeout, startTime);
|
||||||
|
if (result != null && result.length() > 1 && (mComposingText.length() > 0 || mCommittedTextBeforeComposingText.length() > 0)) {
|
||||||
|
final char actualLastChar = result.charAt(result.length() - 1);
|
||||||
|
final char cachedLastChar = mComposingText.length() > 0
|
||||||
|
? mComposingText.charAt(mComposingText.length() - 1)
|
||||||
|
: mCommittedTextBeforeComposingText.charAt(mCommittedTextBeforeComposingText.length() - 1);
|
||||||
|
if (actualLastChar != cachedLastChar) {
|
||||||
|
Log.w(TAG, "cached text out of sync, reloading");
|
||||||
|
ExtractedTextRequest r = new ExtractedTextRequest();
|
||||||
|
final ExtractedText et = mIC.getExtractedText(r, 0);
|
||||||
|
mExpectedSelStart = et.selectionStart + et.startOffset;
|
||||||
|
mExpectedSelEnd = et.selectionEnd + et.startOffset;
|
||||||
|
if (!DebugLogUtils.getStackTrace(2).contains("reloadTextCache")) // clunky bur effective protection against circular reference
|
||||||
|
reloadTextCache();
|
||||||
|
}
|
||||||
|
}
|
||||||
return result;
|
return result;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue