Skip to content

Commit

Permalink
Fix truncation text style after attributed string is changed
Browse files Browse the repository at this point in the history
Fixed in main repo (aad6e3f): TextureGroup#1550
  • Loading branch information
harryworld committed Sep 19, 2019
1 parent f46b39e commit 75f8a3a
Showing 1 changed file with 13 additions and 16 deletions.
29 changes: 13 additions & 16 deletions Source/ASTextNode2.mm
Original file line number Diff line number Diff line change
Expand Up @@ -164,7 +164,6 @@ @implementation ASTextNode {
NSAttributedString *_attributedText;
NSAttributedString *_truncationAttributedText;
NSAttributedString *_additionalTruncationMessage;
NSAttributedString *_composedTruncationText;
NSArray<NSNumber *> *_pointSizeScaleFactors;
NSLineBreakMode _truncationMode;

Expand Down Expand Up @@ -1232,22 +1231,20 @@ - (NSRange)_additionalTruncationMessageRangeWithVisibleRange:(NSRange)visibleRan
- (NSAttributedString *)_locked_composedTruncationText
{
DISABLED_ASAssertLocked(__instanceLock__);
if (_composedTruncationText == nil) {
if (_truncationAttributedText != nil && _additionalTruncationMessage != nil) {
NSMutableAttributedString *newComposedTruncationString = [[NSMutableAttributedString alloc] initWithAttributedString:_truncationAttributedText];
[newComposedTruncationString.mutableString appendString:@" "];
[newComposedTruncationString appendAttributedString:_additionalTruncationMessage];
_composedTruncationText = newComposedTruncationString;
} else if (_truncationAttributedText != nil) {
_composedTruncationText = _truncationAttributedText;
} else if (_additionalTruncationMessage != nil) {
_composedTruncationText = _additionalTruncationMessage;
} else {
_composedTruncationText = DefaultTruncationAttributedString();
}
_composedTruncationText = [self _locked_prepareTruncationStringForDrawing:_composedTruncationText];
NSAttributedString *composedTruncationText = nil;
if (_truncationAttributedText != nil && _additionalTruncationMessage != nil) {
NSMutableAttributedString *newComposedTruncationString = [[NSMutableAttributedString alloc] initWithAttributedString:_truncationAttributedText];
[newComposedTruncationString.mutableString appendString:@" "];
[newComposedTruncationString appendAttributedString:_additionalTruncationMessage];
composedTruncationText = newComposedTruncationString;
} else if (_truncationAttributedText != nil) {
composedTruncationText = _truncationAttributedText;
} else if (_additionalTruncationMessage != nil) {
composedTruncationText = _additionalTruncationMessage;
} else {
composedTruncationText = DefaultTruncationAttributedString();
}
return _composedTruncationText;
return [self _locked_prepareTruncationStringForDrawing:composedTruncationText];
}

/**
Expand Down

0 comments on commit 75f8a3a

Please sign in to comment.