summaryrefslogtreecommitdiff
path: root/internal
diff options
context:
space:
mode:
authorKyren223 <Kyren223@proton.me>2024-12-24 16:45:52 +0200
committerKyren223 <Kyren223@proton.me>2024-12-24 16:45:52 +0200
commit6ca8b70e66c657396007276fd3749801d23180f0 (patch)
tree322fcd1b4ed72f9a82731cbea0fb7425e1184017 /internal
parent54fb74018483e534e967ea1af957fd79286c79e4 (diff)
Fixed a bug where headers won't render as "selected" when you hover over them
Diffstat (limited to 'internal')
-rw-r--r--internal/client/ui/core/chat/chat.go12
1 files changed, 7 insertions, 5 deletions
diff --git a/internal/client/ui/core/chat/chat.go b/internal/client/ui/core/chat/chat.go
index 9d67468..16eeed2 100644
--- a/internal/client/ui/core/chat/chat.go
+++ b/internal/client/ui/core/chat/chat.go
@@ -473,18 +473,19 @@ func (m *Model) renderMessageGroup(group []data.Message, remaining *int, height
buf = append(buf, '\n')
}
+ buf = append(buf, '\n') // Gap between each message group
+ *remaining-- // For gap
+
selectedIndex := -1
for i, h := range heights {
bottom := height - *remaining
top := bottom + h
*remaining -= h
- if bottom < m.index && m.index <= top {
+ if bottom <= m.index && m.index <= top {
selectedIndex = i
}
}
- *remaining-- // For the header
- buf = append(buf, '\n') // Gap between each message group
- *remaining-- // For gap
+ *remaining-- // For the header
if selectedIndex != -1 {
if selectedIndex == len(group)-1 {
@@ -566,6 +567,7 @@ func (m *Model) renderHeader(message data.Message, selected bool) []byte {
}
func (m *Model) Scroll(amount int) {
+ log.Println("SCROLL", m.index, amount)
if m.index == -1 {
if amount <= 0 {
return
@@ -588,7 +590,7 @@ func (m *Model) Scroll(amount int) {
maxHeight = m.messagesHeight
}
if m.index >= maxHeight-1 {
- m.offset = m.index+2
+ m.offset = m.index + 2
}
} else {
// Scrolling down