From e6f1160d7107262e0fc807d31aa46d026520c9cd Mon Sep 17 00:00:00 2001 From: Till Friebe Date: Sat, 22 May 2021 14:48:06 +0200 Subject: [PATCH] Fix exception --- .../raw_editor_state_text_input_client_mixin.dart | 6 +++++- 1 file changed, 5 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 527df582..bfb36106 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 @@ -103,7 +103,11 @@ mixin RawEditorStateTextInputClientMixin on EditorState final shouldRemember = getTextEditingValue().text != _lastKnownRemoteTextEditingValue!.text; _lastKnownRemoteTextEditingValue = actualValue; - _textInputConnection!.setEditingState(actualValue); + _textInputConnection!.setEditingState( + // Set composing to (-1, -1), otherwise an exception will be thrown if + // the values are different. + actualValue.copyWith(composing: const TextRange(start: -1, end: -1)), + ); if (shouldRemember) { // Only keep track if text changed (selection changes are not relevant) _sentRemoteValues.add(actualValue);