mirror of
https://github.com/Swiftgram/Telegram-iOS.git
synced 2025-12-22 22:25:57 +00:00
Update string attribute range clipping
This commit is contained in:
@@ -18,8 +18,10 @@ public func chatInputStateStringWithAppliedEntities(_ text: String, entities: [M
|
||||
if nsString == nil {
|
||||
nsString = text as NSString
|
||||
}
|
||||
if range.location >= stringLength {
|
||||
continue
|
||||
}
|
||||
if range.location + range.length > stringLength {
|
||||
range.location = max(0, stringLength - range.length)
|
||||
range.length = stringLength - range.location
|
||||
}
|
||||
switch entity.type {
|
||||
@@ -75,7 +77,6 @@ public func stringWithAppliedEntities(_ text: String, entities: [MessageTextEnti
|
||||
if range.location > stringLength {
|
||||
continue
|
||||
} else if range.location + range.length > stringLength {
|
||||
range.location = max(0, stringLength - range.length)
|
||||
range.length = stringLength - range.location
|
||||
}
|
||||
switch entity.type {
|
||||
|
||||
Reference in New Issue
Block a user