diff options
| author | Kyren223 <Kyren223@proton.me> | 2025-01-15 19:30:28 +0200 |
|---|---|---|
| committer | Kyren223 <Kyren223@proton.me> | 2025-01-15 19:30:28 +0200 |
| commit | 5bc8a1ff7aae46225084a08d6f2c96d076860574 (patch) | |
| tree | 5e5b453fbbd16a6de071796fb3dc9f360c6151da /internal | |
| parent | adacdcd6f85b85a8e4b660f8a3d318340a493d3d (diff) | |
Gap lines in chat are now highlighted to better visualize scrolling
Diffstat (limited to 'internal')
| -rw-r--r-- | internal/client/ui/core/chat/chat.go | 21 |
1 files changed, 14 insertions, 7 deletions
diff --git a/internal/client/ui/core/chat/chat.go b/internal/client/ui/core/chat/chat.go index 3173342..239f823 100644 --- a/internal/client/ui/core/chat/chat.go +++ b/internal/client/ui/core/chat/chat.go @@ -47,6 +47,8 @@ var ( Foreground(colors.LightGray).Padding(0, PaddingCount, 1). AlignHorizontal(lipgloss.Center).AlignVertical(lipgloss.Bottom). SetString("This frequency has no messages, start transmiting!") + + SelectedGap = lipgloss.NewStyle().Background(colors.BackgroundDim) ) const ( @@ -559,8 +561,13 @@ 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 + // Gap between each message group + if m.index == height-*remaining { + gap := SelectedGap.Width(m.width).String() + buf = append(buf, gap...) + } + buf = append(buf, '\n') + *remaining-- selectedIndex := -1 for i, h := range heights { @@ -657,11 +664,7 @@ func (m *Model) Scroll(amount int) { log.Println("unselected, base:", m.base, "height", m.messagesHeight) if m.base != SnapToBottom { index = m.base - m.messagesHeight - } - // TODO: should this happen only if u r at "snap to bottom"? - // Bcz otherwise there is no gurantee that the bottom most line - // is blank - if amount > 0 { + } else if amount > 0 { amount++ // Skip the blank line at the bottom } } @@ -698,4 +701,8 @@ func (m *Model) SetIndex(index int) { if m.index <= 1 { m.base = SnapToBottom } + + if m.index == 0 { + m.index = Unselected + } } |
