Skip to content

Commit 002f576

Browse files
theimpulsonmikeNG
authored andcommitted
RichInputConnection: Force batch edit restart when querying text near cursor
Issue: calyxos#2916 Change-Id: I7daad9ab62f87d4dcff02f0993b33a85a815896f Signed-off-by: Aayush Gupta <aayushgupta219@gmail.com>
1 parent 7653e63 commit 002f576

1 file changed

Lines changed: 9 additions & 0 deletions

File tree

java/src/com/android/inputmethod/latin/RichInputConnection.java

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -705,6 +705,15 @@ public TextRange getWordRangeAtCursor(final SpacingAndPunctuations spacingAndPun
705705
if (!isConnected()) {
706706
return null;
707707
}
708+
709+
// Restart batch edit to force state update for broken web apps (for e.g. ProtonMail)
710+
// as batch edit mode avoids sending state updates until batch edit end.
711+
// See beginBatchEdit mode documentation for further information.
712+
if (mNestLevel > 0) {
713+
endBatchEdit();
714+
beginBatchEdit();
715+
}
716+
708717
final CharSequence before = getTextBeforeCursorAndDetectLaggyConnection(
709718
OPERATION_GET_WORD_RANGE_AT_CURSOR,
710719
SLOW_INPUT_CONNECTION_ON_PARTIAL_RELOAD_MS,

0 commit comments

Comments
 (0)