From 14d871e3171583d35efe2aa2521fc9218f10ff52 Mon Sep 17 00:00:00 2001 From: Alan Mantoux Date: Sun, 11 Aug 2024 18:52:22 +0200 Subject: [PATCH] Always keep natural order of selection boundaries when setting clipboard data --- packages/fleather/lib/src/widgets/editor.dart | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/packages/fleather/lib/src/widgets/editor.dart b/packages/fleather/lib/src/widgets/editor.dart index 43379301..72c3a694 100644 --- a/packages/fleather/lib/src/widgets/editor.dart +++ b/packages/fleather/lib/src/widgets/editor.dart @@ -1260,7 +1260,8 @@ class RawEditorState extends EditorState plainText: selection.textInside(textEditingValue.text), delta: controller.document .toDelta() - .slice(selection.baseOffset, selection.extentOffset), + .slice(math.min(selection.baseOffset, selection.extentOffset), + math.max(selection.baseOffset, selection.extentOffset)), )); }