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:
parent
e1ddd58df4
commit
30087ae0f3
2 changed files with 10 additions and 10 deletions
|
@ -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:]
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue