summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--internal/client/ui/core/chat/chat.go3
1 files changed, 2 insertions, 1 deletions
diff --git a/internal/client/ui/core/chat/chat.go b/internal/client/ui/core/chat/chat.go
index 70dbe96..43b7a44 100644
--- a/internal/client/ui/core/chat/chat.go
+++ b/internal/client/ui/core/chat/chat.go
@@ -1224,7 +1224,8 @@ func (m *Model) SetIndex(index int) {
if m.maxMessagesHeight != -1 {
maxHeight = m.maxMessagesHeight - 1
}
- m.index = min(max(index, Unselected), maxHeight)
+ // Order is significant, max(unselected) must be the last operation
+ m.index = max(min(index, maxHeight), Unselected)
if m.index == Unselected {
return