This commit is contained in:
Kovid Goyal 2021-11-11 20:53:14 +05:30
parent e65aee4533
commit 228364e317
No known key found for this signature in database
GPG Key ID: 06BC317B515ACE7C

View File

@ -1441,13 +1441,14 @@ is_ascii_control_char(char x) {
replacementRange:(NSRange)replacementRange
{
(void)selectedRange; (void)replacementRange;
[markedText release];
if (string == nil) { [self unmarkText]; return; }
if ([string isKindOfClass:[NSAttributedString class]]) {
if (((NSMutableAttributedString*)string).length == 0) { [self unmarkText]; return; }
[markedText release];
markedText = [[NSMutableAttributedString alloc] initWithAttributedString:string];
} else {
if (((NSString*)string).length == 0) { [self unmarkText]; return; }
[markedText release];
markedText = [[NSMutableAttributedString alloc] initWithString:string];
}
}