summaryrefslogtreecommitdiff
path: root/internal/client/ui/core/chat/chat.go
diff options
context:
space:
mode:
authorKyren223 <Kyren223@proton.me>2025-01-28 18:50:20 +0200
committerKyren223 <Kyren223@proton.me>2025-01-28 18:50:20 +0200
commit9f6a91900e01f06e1dda982028c990bd55db315a (patch)
treee260a8adeb3efd79e051d9da95661c66e0189f72 /internal/client/ui/core/chat/chat.go
parent3cb6290617a6616b61db145508c79eaddfe3a147 (diff)
Fixed a bug where you could scroll infinitely down
Diffstat (limited to 'internal/client/ui/core/chat/chat.go')
-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