Browse Source

Prevent redundant updates on composing range for Android

Anatoly Pulyaevskiy 6 years ago
parent
commit
1eaa52f35f
1 changed files with 13 additions and 0 deletions
  1. 13
    0
      packages/zefyr/lib/src/widgets/input.dart

+ 13
- 0
packages/zefyr/lib/src/widgets/input.dart View File

@@ -119,6 +119,19 @@ class InputConnectionController implements TextInputClient {
119 119
       return;
120 120
     }
121 121
 
122
+    // Check if only composing range changed.
123
+    if (_lastKnownRemoteTextEditingValue.text == value.text &&
124
+        _lastKnownRemoteTextEditingValue.selection == value.selection) {
125
+      // This update only modifies composing range. Since we don't keep track
126
+      // of composing range in Zefyr we just need to update last known value
127
+      // here.
128
+      // Note: this check fixes an issue on Android when it sends
129
+      // composing updates separately from regular changes for text and
130
+      // selection.
131
+      _lastKnownRemoteTextEditingValue = value;
132
+      return;
133
+    }
134
+
122 135
     // Note Flutter (unintentionally?) silences errors occurred during
123 136
     // text input update, so we have to report it ourselves.
124 137
     // For more details see https://github.com/flutter/flutter/issues/19191