diff options
| author | Kyren223 <Kyren223@proton.me> | 2024-12-24 16:45:52 +0200 |
|---|---|---|
| committer | Kyren223 <Kyren223@proton.me> | 2024-12-24 16:45:52 +0200 |
| commit | 6ca8b70e66c657396007276fd3749801d23180f0 (patch) | |
| tree | 322fcd1b4ed72f9a82731cbea0fb7425e1184017 | |
| parent | 54fb74018483e534e967ea1af957fd79286c79e4 (diff) | |
Fixed a bug where headers won't render as "selected" when you hover over them
| -rw-r--r-- | internal/client/ui/core/chat/chat.go | 12 |
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 |
