From 95ba7a892224653eb97f3cad501273eb8fc152aa Mon Sep 17 00:00:00 2001 From: crasowas <110958409+crasowas@users.noreply.github.com> Date: Tue, 28 May 2024 11:22:00 +0800 Subject: [PATCH] fix: assertion failure for swipe typing and undo on Android --- .../raw_editor/raw_editor_state_text_input_client_mixin.dart | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/lib/src/widgets/raw_editor/raw_editor_state_text_input_client_mixin.dart b/lib/src/widgets/raw_editor/raw_editor_state_text_input_client_mixin.dart index 79e859507..2c792741a 100644 --- a/lib/src/widgets/raw_editor/raw_editor_state_text_input_client_mixin.dart +++ b/lib/src/widgets/raw_editor/raw_editor_state_text_input_client_mixin.dart @@ -141,8 +141,10 @@ mixin RawEditorStateTextInputClientMixin on EditorState // with the last known remote value. // It is important to prevent excessive remote updates as it can cause // race conditions. + final composingRange = _lastKnownRemoteTextEditingValue!.composing; final actualValue = value.copyWith( - composing: _lastKnownRemoteTextEditingValue!.composing, + // Ignore last known composing range if it exceeds current text length. + composing: composingRange.end > value.text.length ? null : composingRange, ); if (actualValue == _lastKnownRemoteTextEditingValue) {