4096 is the default message splitting boundary

This commit is contained in:
Ali 2019-11-26 20:51:34 +04:00
parent 8a3695ca13
commit 1193778726

View File

@ -560,14 +560,14 @@ public func trimChatInputText(_ text: NSAttributedString) -> NSAttributedString
}
public func breakChatInputText(_ text: NSAttributedString) -> [NSAttributedString] {
if text.length <= 4000 {
if text.length <= 4096 {
return [text]
} else {
let rawText: NSString = text.string as NSString
var result: [NSAttributedString] = []
var offset = 0
while offset < text.length {
var range = NSRange(location: offset, length: min(text.length - offset, 4000))
var range = NSRange(location: offset, length: min(text.length - offset, 4096))
if range.upperBound < text.length {
inner: for i in (range.lowerBound ..< range.upperBound).reversed() {
let c = rawText.character(at: i)