File tree Expand file tree Collapse file tree 2 files changed +31
-1
lines changed Expand file tree Collapse file tree 2 files changed +31
-1
lines changed Original file line number Diff line number Diff line change @@ -4494,7 +4494,6 @@ class EditableTextState extends State<EditableText> with AutomaticKeepAliveClien
4494
4494
Rect ? composingRect = renderEditable.getRectForComposingRange (composingRange);
4495
4495
// Send the caret location instead if there's no marked text yet.
4496
4496
if (composingRect == null ) {
4497
- assert (! composingRange.isValid || composingRange.isCollapsed);
4498
4497
final int offset = composingRange.isValid ? composingRange.start : 0 ;
4499
4498
composingRect = renderEditable.getLocalRectForCaret (TextPosition (offset: offset));
4500
4499
}
Original file line number Diff line number Diff line change @@ -17548,6 +17548,37 @@ void main() {
17548
17548
const TextSelection.collapsed(offset: 17, affinity: TextAffinity.upstream),
17549
17549
);
17550
17550
});
17551
+
17552
+ testWidgets('Composing region can truncate grapheme', (WidgetTester tester) async {
17553
+ await tester.pumpWidget(
17554
+ MediaQuery(
17555
+ data: const MediaQueryData(),
17556
+ child: Directionality(
17557
+ textDirection: TextDirection.ltr,
17558
+ child: EditableText(
17559
+ autofocus: true,
17560
+ backgroundCursorColor: Colors.grey,
17561
+ controller: controller,
17562
+ focusNode: focusNode,
17563
+ style: textStyle,
17564
+ cursorColor: cursorColor,
17565
+ ),
17566
+ ),
17567
+ ),
17568
+ );
17569
+
17570
+ await tester.pumpAndSettle();
17571
+ assert(focusNode.hasFocus);
17572
+
17573
+ controller.value = const TextEditingValue(
17574
+ text: 'Á',
17575
+ selection: TextSelection(baseOffset: 1, extentOffset: 2),
17576
+ composing: TextSelection(baseOffset: 1, extentOffset: 2),
17577
+ );
17578
+ await tester.pumpAndSettle();
17579
+
17580
+ expect(tester.takeException(), isNull);
17581
+ });
17551
17582
}
17552
17583
17553
17584
class UnsettableController extends TextEditingController {
You can’t perform that action at this time.
0 commit comments