From 9f6a91900e01f06e1dda982028c990bd55db315a Mon Sep 17 00:00:00 2001 From: Kyren223 Date: Tue, 28 Jan 2025 18:50:20 +0200 Subject: Fixed a bug where you could scroll infinitely down --- internal/client/ui/core/chat/chat.go | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) (limited to 'internal/client/ui/core/chat/chat.go') 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 -- cgit v1.3.1