From e2dc2854b7041c0d910cdb84cabf12254dfeb4c6 Mon Sep 17 00:00:00 2001 From: marcusDenslow Date: Sat, 25 Apr 2026 22:18:43 +0200 Subject: [PATCH] fix: add 1-item scroll buffer and use highlight color for selected border 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 --- pkg/tui/account.go | 12 ++++++------ pkg/tui/account_orders.go | 2 +- 2 files changed, 7 insertions(+), 7 deletions(-) diff --git a/pkg/tui/account.go b/pkg/tui/account.go index c77d0e7..ddfd68a 100644 --- a/pkg/tui/account.go +++ b/pkg/tui/account.go @@ -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 diff --git a/pkg/tui/account_orders.go b/pkg/tui/account_orders.go index 3b24bc5..5f52f48 100644 --- a/pkg/tui/account_orders.go +++ b/pkg/tui/account_orders.go @@ -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()) }