mirror of
https://github.com/marcusDenslow/terminalShop.git
synced 2026-10-25 10:02:21 +01:00
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 <noreply@anthropic.com>
This commit is contained in:
@@ -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
|
||||
|
||||
@@ -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())
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user