diff --git a/EGOTextView/EGOTextView.m b/EGOTextView/EGOTextView.m index cb5b4ef..e4d70bb 100644 --- a/EGOTextView/EGOTextView.m +++ b/EGOTextView/EGOTextView.m @@ -1156,7 +1156,7 @@ - (void)setMarkedText:(NSString *)markedText selectedRange:(NSRange)selectedRang selectedNSRange = NSMakeRange(selectedRange.location + markedTextRange.location, selectedRange.length); - self.attributedString = _attributedString; + self.attributedString = markedText.length == 0 ? _attributedString : _mutableAttributedString; self.markedRange = markedTextRange; self.selectedRange = selectedNSRange;