@@ -134,20 +134,22 @@ class SingleColumnLayoutSelectionStyler extends SingleColumnLayoutStylePhase {
134
134
if (viewModel is TextComponentViewModel ) {
135
135
final componentTextColor = viewModel.textStyleBuilder ({}).color;
136
136
137
- final textWithSelectionAttributions =
138
- textSelection != null && _selectedTextColorStrategy != null && componentTextColor != null
139
- ? (viewModel.text.copyText (0 )
140
- ..addAttribution (
141
- ColorAttribution (_selectedTextColorStrategy !(
142
- originalTextColor: componentTextColor,
143
- selectionHighlightColor: _selectionStyles.selectionColor,
144
- )),
145
- SpanRange (textSelection.start, textSelection.end - 1 ),
146
- // The selected range might already have a color attribution. We want to override it
147
- // with the selected text color.
148
- overwriteConflictingSpans: true ,
149
- ))
150
- : viewModel.text;
137
+ final textWithSelectionAttributions = textSelection != null &&
138
+ ! textSelection.isCollapsed &&
139
+ _selectedTextColorStrategy != null &&
140
+ componentTextColor != null
141
+ ? (viewModel.text.copyText (0 )
142
+ ..addAttribution (
143
+ ColorAttribution (_selectedTextColorStrategy !(
144
+ originalTextColor: componentTextColor,
145
+ selectionHighlightColor: _selectionStyles.selectionColor,
146
+ )),
147
+ SpanRange (textSelection.start, textSelection.end - 1 ),
148
+ // The selected range might already have a color attribution. We want to override it
149
+ // with the selected text color.
150
+ overwriteConflictingSpans: true ,
151
+ ))
152
+ : viewModel.text;
151
153
152
154
viewModel
153
155
..text = textWithSelectionAttributions
0 commit comments