diff --git a/ios/enrichedInputTextView/EnrichedInputTextView.mm b/ios/enrichedInputTextView/EnrichedInputTextView.mm index 4e8dd50ba..65ada0d35 100644 --- a/ios/enrichedInputTextView/EnrichedInputTextView.mm +++ b/ios/enrichedInputTextView/EnrichedInputTextView.mm @@ -56,6 +56,15 @@ - (CGRect)caretRectForPosition:(UITextPosition *)position { rect.origin.x = (containerWidth - rect.size.width) / 2.0; } else if (alignment == NSTextAlignmentRight) { rect.origin.x = containerWidth - rect.size.width; + } else { + // when we change selection to the last empty line in the editor, + // where we literally have no character there, UIKit seems to need to know + // the line's expected geometry (indent) and it derives typing attributes + // from the previous character (previous line). Happens even though we + // explicitly didn't want that in + // manageTypingAttributesWithOnlySelection:YES, so we can't trust typing + // attributes' pStyle here, manually setting the caret's position + rect.origin.x = 0; } return rect;