From 189713b264519741792da95e82b7c8b40d77ca9b Mon Sep 17 00:00:00 2001 From: crasowas <110958409+crasowas@users.noreply.github.com> Date: Tue, 28 May 2024 12:17:41 +0800 Subject: [PATCH] fix: assertion failure for swipe typing and undo on Android (#1898) --- .../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 79e85950..2c792741 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) {