@@ -745,10 +745,7 @@ func (m *Chat) selectWord(itemIdx, x, itemY int) {
745 // Adjust x for the item's left padding (border + padding) to get content column.
745 // Adjust x for the item's left padding (border + padding) to get content column.
746 // The mouse x is in viewport space, but we need content space for boundary detection.
746 // The mouse x is in viewport space, but we need content space for boundary detection.
747 offset := chat.MessageLeftPaddingTotal
747 offset := chat.MessageLeftPaddingTotal
748− contentX := x - offset
748+ contentX := max(x-offset, 0)
753 line := ansi.Strip(lines[itemY])
750 line := ansi.Strip(lines[itemY])
754 startCol, endCol := findWordBoundaries(line, contentX)
751 startCol, endCol := findWordBoundaries(line, contentX)