fix: add 1-item scroll buffer and use highlight color for selected border
Some checks failed
Deploy / deploy (push) Has been cancelled

Scroll triggers when the next item would be off-screen, not when the
current item hits the edge. Selected border now uses highlight color
(steel blue) instead of accent (white) for visibility on all themes.

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
This commit is contained in:
2026-04-25 22:18:43 +02:00
parent f9885e2d5e
commit e2dc2854b7
2 changed files with 7 additions and 7 deletions

View File

@@ -129,13 +129,13 @@ func (m Model) scrollToAccountDetailItem() Model {
vpH := m.account.detailViewport.Height
offset := m.account.detailViewport.YOffset
// If item is above viewport, scroll up to show it
if targetY < offset {
m.account.detailViewport.SetYOffset(targetY)
// 1-item buffer: scroll when the NEXT item would be off-screen,
// not when the current item hits the very edge
if targetY-itemHeight < offset {
m.account.detailViewport.SetYOffset(targetY - itemHeight)
}
// If item is below viewport, scroll down to show it
if targetY+itemHeight > offset+vpH {
m.account.detailViewport.SetYOffset(targetY - vpH + itemHeight)
if targetY+itemHeight+itemHeight > offset+vpH {
m.account.detailViewport.SetYOffset(targetY - vpH + itemHeight + itemHeight)
}
return m

View File

@@ -88,7 +88,7 @@ func (m Model) buildOrderCard(order models.Order, boxWidth int, isSelected bool)
var itemBox lipgloss.Style
if isSelected {
itemBox = base.BorderForeground(m.theme.Accent())
itemBox = base.BorderForeground(m.theme.Highlight())
} else {
itemBox = base.BorderForeground(m.theme.Border())
}