소스 검색

Prevent redundant updates on composing range for Android

Anatoly Pulyaevskiy 6 년 전
부모
커밋
1eaa52f35f
1개의 변경된 파일13개의 추가작업 그리고 0개의 파일을 삭제
  1. 13
    0
      packages/zefyr/lib/src/widgets/input.dart

+ 13
- 0
packages/zefyr/lib/src/widgets/input.dart 파일 보기

@@ -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