@@ -203,7 +203,7 @@ mixin RawEditorStateTextInputClientMixin on EditorState implements DeltaTextInpu
203203
204204 @override
205205 void updateEditingValueWithDeltas (List <TextEditingDelta > textEditingDeltas) {
206- if (! shouldCreateInputConnection) {
206+ if (! shouldCreateInputConnection || textEditingDeltas.isEmpty ) {
207207 return ;
208208 }
209209 _apply (textEditingDeltas);
@@ -212,16 +212,7 @@ mixin RawEditorStateTextInputClientMixin on EditorState implements DeltaTextInpu
212212 void _apply (List <TextEditingDelta > deltas) {
213213 for (final delta in deltas) {
214214 // updates _lastKnownRemoteTextEditingValue to avoid issues
215-
216- _lastKnownRemoteTextEditingValue = delta.apply (
217- TextEditingValue (
218- text: _lastKnownRemoteTextEditingValue? .text ??
219- widget.controller.document.toPlainText (),
220- selection:
221- _lastKnownRemoteTextEditingValue? .selection ?? widget.controller.selection,
222- composing: _lastKnownRemoteTextEditingValue? .composing ?? TextRange .empty,
223- ),
224- );
215+ _updateLastKnownRemoteTextEditingValueWithDeltas (delta);
225216 if (delta is TextEditingDeltaInsertion ) {
226217 onInsert (
227218 delta,
@@ -380,6 +371,14 @@ mixin RawEditorStateTextInputClientMixin on EditorState implements DeltaTextInpu
380371 _lastKnownRemoteTextEditingValue = null ;
381372 }
382373
374+ @visibleForTesting
375+ @internal
376+ void updateLastKnownRemoteTextEditingValueWithDeltas (TextEditingDelta delta) {
377+ // Apply the deltas to the previous platform-side IME value, to find out
378+ // what the platform thinks the IME value is
379+ _lastKnownRemoteTextEditingValue = delta.apply (_lastKnownRemoteTextEditingValue! );
380+ }
381+
383382 void _updateSizeAndTransform () {
384383 if (hasConnection) {
385384 // Asking for renderEditor.size here can cause errors if layout hasn't
0 commit comments