Fix calculating reply end offset

This commit is contained in:
Bohdan Horbeshko 2025-08-23 07:28:08 -04:00
parent 84a6484e86
commit a17b4892fc

View file

@ -1734,8 +1734,10 @@ func (c *Client) messageToPrefix(message *client.Message, previewString string,
reply = gwReply reply = gwReply
var replyStart, replyEnd int var replyStart, replyEnd int
var hadPrefix bool
if len(prefix) > 0 { if len(prefix) > 0 {
hadPrefix = true
replyStart = c.countCharsInLines(&prefix) + (len(prefix)-1)*len(messageHeaderSeparator) replyStart = c.countCharsInLines(&prefix) + (len(prefix)-1)*len(messageHeaderSeparator)
} }
@ -1743,7 +1745,7 @@ func (c *Client) messageToPrefix(message *client.Message, previewString string,
prefix = append(prefix, replyLine) prefix = append(prefix, replyLine)
replyEnd = replyStart + utf8.RuneCountInString(replyLine) replyEnd = replyStart + utf8.RuneCountInString(replyLine)
if len(prefix) > 0 { if hadPrefix {
replyEnd += len(messageHeaderSeparator) replyEnd += len(messageHeaderSeparator)
} }