Skip to content

Commit

Permalink
Revert "Don't add extraneous truncation token during kCTLineTruncatio…
Browse files Browse the repository at this point in the history
…nMiddle. (#1297)"

This reverts commit 7bb3079.
  • Loading branch information
Adlai-Holler authored Mar 6, 2019
1 parent 7bb3079 commit c77dddf
Showing 1 changed file with 3 additions and 7 deletions.
10 changes: 3 additions & 7 deletions Source/Private/TextExperiment/Component/ASTextLayout.mm
Original file line number Diff line number Diff line change
Expand Up @@ -834,8 +834,7 @@ + (ASTextLayout *)layoutWithContainer:(ASTextContainer *)container text:(NSAttri
}
}
int i = 0;
if (type != kCTLineTruncationStart) { // Middle or End/Tail wants to collect some text (at least one line's
// worth) preceding the truncated content, with which to construct a "truncated line".
if (type != kCTLineTruncationStart) { // Middle or End/Tail wants text preceding truncated content.
i = (int)removedLines.count - 1;
while (atLeastOneLine < truncatedWidth && i >= 0) {
if (lastLineText.length > 0 && [lastLineText.string characterAtIndex:lastLineText.string.length - 1] == '\n') { // Explicit newlines are always "long enough".
Expand All @@ -847,8 +846,7 @@ + (ASTextLayout *)layoutWithContainer:(ASTextContainer *)container text:(NSAttri
}
[lastLineText appendAttributedString:truncationToken];
}
if (type != kCTLineTruncationEnd && removedLines.count > 0) { // Middle or Start/Head wants to collect some
// text following the truncated content.
if (type != kCTLineTruncationEnd && removedLines.count > 0) { // Middle or Start/Head wants text following truncated content.
i = 0;
atLeastOneLine = removedLines[i].width;
while (atLeastOneLine < truncatedWidth && i < removedLines.count) {
Expand All @@ -862,9 +860,7 @@ + (ASTextLayout *)layoutWithContainer:(ASTextContainer *)container text:(NSAttri
[lastLineText appendAttributedString:nextLine];
}
}
if (type == kCTLineTruncationStart) {
[lastLineText insertAttributedString:truncationToken atIndex:0];
}
[lastLineText insertAttributedString:truncationToken atIndex:0];
}

CTLineRef ctLastLineExtend = CTLineCreateWithAttributedString((CFAttributedStringRef) lastLineText);
Expand Down

0 comments on commit c77dddf

Please sign in to comment.