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
44944494 Rect ? composingRect = renderEditable.getRectForComposingRange (composingRange);
44954495 // Send the caret location instead if there's no marked text yet.
44964496 if (composingRect == null ) {
4497- assert (! composingRange.isValid || composingRange.isCollapsed);
44984497 final int offset = composingRange.isValid ? composingRange.start : 0 ;
44994498 composingRect = renderEditable.getLocalRectForCaret (TextPosition (offset: offset));
45004499 }
Original file line number Diff line number Diff line change @@ -17548,6 +17548,37 @@ void main() {
1754817548 const TextSelection.collapsed(offset: 17, affinity: TextAffinity.upstream),
1754917549 );
1755017550 });
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+ });
1755117582}
1755217583
1755317584class UnsettableController extends TextEditingController {
You can’t perform that action at this time.
0 commit comments