1
0
Fork 0
mirror of https://github.com/fluffle/goirc synced 2025-07-01 02:53:53 +00:00

client/commands: leave space for ellipsis

This commit is contained in:
StalkR 2015-04-14 12:18:11 +02:00
parent e1ddd58df4
commit 30087ae0f3
2 changed files with 10 additions and 10 deletions

View file

@ -64,13 +64,13 @@ func indexFragment(s string) int {
// 3. splitLen itself
func splitMessage(msg string, splitLen int) (msgs []string) {
// This is quite short ;-)
if splitLen < 10 {
splitLen = 10
if splitLen < 13 {
splitLen = 13
}
for len(msg) > splitLen {
idx := indexFragment(msg[:splitLen])
idx := indexFragment(msg[:splitLen-3])
if idx < 0 {
idx = splitLen
idx = splitLen - 3
}
msgs = append(msgs, msg[:idx] + "...")
msg = msg[idx:]