fix: check text editing controlling, if selection is valid (#10868)
Signed-off-by: fufesou <linlong1266@gmail.com>
This commit is contained in:
parent
2575e14811
commit
fc396d2166
1 changed files with 4 additions and 4 deletions
|
|
@ -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;
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue