Fix splitting long messages without spaces. Fixes #38
This commit is contained in:
parent
74119ee242
commit
cc929ba899
@ -72,20 +72,16 @@ func (msg *BaseTextMessage) calculateBufferWithText(text tstring.TString, width
|
|||||||
}
|
}
|
||||||
|
|
||||||
matches := boundaryPattern.FindAllStringIndex(extract.String(), -1)
|
matches := boundaryPattern.FindAllStringIndex(extract.String(), -1)
|
||||||
if len(matches) == 0 {
|
if len(matches) > 0 {
|
||||||
continue
|
|
||||||
}
|
|
||||||
|
|
||||||
match := matches[len(matches)-1]
|
match := matches[len(matches)-1]
|
||||||
if len(match) < 2 {
|
if len(match) >= 2 {
|
||||||
continue
|
|
||||||
}
|
|
||||||
|
|
||||||
until := match[1]
|
until := match[1]
|
||||||
if until < len(extract) {
|
if until < len(extract) {
|
||||||
extract = extract[:until]
|
extract = extract[:until]
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
msg.buffer = append(msg.buffer, extract)
|
msg.buffer = append(msg.buffer, extract)
|
||||||
str = str[len(extract):]
|
str = str[len(extract):]
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user