mirror of
https://github.com/Swiftgram/Telegram-iOS.git
synced 2025-10-09 11:23:48 +00:00
TextNode: Add more checks
This commit is contained in:
parent
4447916713
commit
3dfa391714
@ -1086,6 +1086,7 @@ public class TextNode: ASDisplayNode {
|
||||
}
|
||||
|
||||
var headIndent: CGFloat = 0.0
|
||||
if brokenLineRange.location >= 0 && brokenLineRange.length > 0 && brokenLineRange.location + brokenLineRange.length <= attributedString.length {
|
||||
attributedString.enumerateAttributes(in: NSMakeRange(brokenLineRange.location, brokenLineRange.length), options: []) { attributes, range, _ in
|
||||
if attributes[NSAttributedString.Key(rawValue: "TelegramSpoiler")] != nil || attributes[NSAttributedString.Key(rawValue: "Attribute__Spoiler")] != nil {
|
||||
var ascent: CGFloat = 0.0
|
||||
@ -1126,6 +1127,7 @@ public class TextNode: ASDisplayNode {
|
||||
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
let lineWidth = min(lineConstrainedSize.width, ceil(CGFloat(CTLineGetTypographicBounds(coreTextLine, nil, nil, nil) - CTLineGetTrailingWhitespaceWidth(coreTextLine))))
|
||||
let lineFrame = CGRect(x: lineCutoutOffset + headIndent, y: lineOriginY, width: lineWidth, height: fontLineHeight)
|
||||
|
Loading…
x
Reference in New Issue
Block a user