Skip to content

Commit f678b77

Browse files
authored
Make iOS trailing newlines not use current typing attributes (#183)
Trailing newlines on iOS need to be measured as if there was a fake `I` character to get the proper measurement. But incorrectly, current typing attributes were used for the character. This resulted in a funny thing; trailing newline would change sizes if we changed selection from a, say, heading line to non heading line. Now it uses the default typing attributes.
1 parent a92ac63 commit f678b77

1 file changed

Lines changed: 1 addition & 1 deletion

File tree

ios/EnrichedTextInputView.mm

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -565,7 +565,7 @@ - (CGSize)measureSize:(CGFloat)maxWidth {
565565
unichar lastChar = [currentStr.string characterAtIndex:currentStr.length-1];
566566
if([[NSCharacterSet newlineCharacterSet] characterIsMember:lastChar]) {
567567
[currentStr appendAttributedString:
568-
[[NSAttributedString alloc] initWithString:@"I" attributes:textView.typingAttributes]
568+
[[NSAttributedString alloc] initWithString:@"I" attributes:defaultTypingAttributes]
569569
];
570570
}
571571
}

0 commit comments

Comments
 (0)