mirror of
https://github.com/Swiftgram/Telegram-iOS.git
synced 2025-06-16 05:55:20 +00:00
Fix text overflow
This commit is contained in:
parent
ac22c025e1
commit
9cdca2ada6
@ -1262,32 +1262,13 @@ open class TextNode: ASDisplayNode {
|
||||
|
||||
if lineRange.length == 0 || (CTLineGetTypographicBounds(originalLine, nil, nil, nil) - CTLineGetTrailingWhitespaceWidth(originalLine) + truncationTokenWidth) < Double(lineConstrainedSize.width) {
|
||||
if didClipLinebreak {
|
||||
coreTextLine = originalLine
|
||||
if lineRange.length == 0 {
|
||||
coreTextLine = CTLineCreateWithAttributedString(NSAttributedString())
|
||||
} else {
|
||||
coreTextLine = originalLine
|
||||
}
|
||||
additionalTrailingLine = (truncationToken, truncationTokenWidth)
|
||||
|
||||
/*let mergedLine = NSMutableAttributedString()
|
||||
mergedLine.append(attributedString.attributedSubstring(from: NSRange(location: lineRange.location, length: lineRange.length)))
|
||||
mergedLine.append(truncatedTokenString)
|
||||
|
||||
coreTextLine = CTLineCreateWithAttributedString(mergedLine)
|
||||
|
||||
let runs = (CTLineGetGlyphRuns(coreTextLine) as [AnyObject]) as! [CTRun]
|
||||
for run in runs {
|
||||
let runAttributes: NSDictionary = CTRunGetAttributes(run)
|
||||
if let _ = runAttributes["CTForegroundColorFromContext"] {
|
||||
brokenLineRange.length = CTRunGetStringRange(run).location - brokenLineRange.location
|
||||
break
|
||||
}
|
||||
}
|
||||
if brokenLineRange.location + brokenLineRange.length > lineRange.location + lineRange.length {
|
||||
brokenLineRange.location = lineRange.location
|
||||
brokenLineRange.length = lineRange.length
|
||||
}
|
||||
if brokenLineRange.location + brokenLineRange.length > attributedString.length {
|
||||
brokenLineRange.length = attributedString.length - brokenLineRange.location
|
||||
}
|
||||
effectiveLineRange = brokenLineRange*/
|
||||
|
||||
truncated = true
|
||||
} else {
|
||||
coreTextLine = originalLine
|
||||
|
Loading…
x
Reference in New Issue
Block a user