Skip to content

An open-source remote desktop application designed for self-hosting, as an alternative to TeamViewer.

fix: check text editing controlling, if selection is valid (#10868)

fufesoufc396d216615
diff --git a/flutter/lib/common.dart b/flutter/lib/common.dart
index 777924c66..205f30a68 100644
--- a/flutter/lib/common.dart
+++ b/flutter/lib/common.dart
@@ -3706,11 +3706,11 @@ Widget workaroundWindowBorder(BuildContext context, Widget child) {
);
}
-void updateTextAndPreserveSelection(TextEditingController controller, String text) {
- final preSelectionStart = controller.selection.start;
- final preSelectionEnd = controller.selection.end;
+void updateTextAndPreserveSelection(
+ TextEditingController controller, String text) {
// Only care about select all for now.
- final isSelected = preSelectionEnd > preSelectionStart;
+ final isSelected = controller.selection.isValid &&
+ controller.selection.end > controller.selection.start;
// Set text will make the selection invalid.
controller.text = text;