From 1726c2ed1080ec192148fef72bf81ee91a93e63c Mon Sep 17 00:00:00 2001 From: Carlos Alexandro Becker Date: Fri, 17 Oct 2025 11:51:34 -0300 Subject: [PATCH] fix: re-render on height change Signed-off-by: Carlos Alexandro Becker --- internal/tui/exp/list/list.go | 12 ++++++++---- 1 file changed, 8 insertions(+), 4 deletions(-) diff --git a/internal/tui/exp/list/list.go b/internal/tui/exp/list/list.go index a86562efdae2cc1aebb335f18c85cd3bb15bcc7d..779693ea7d83f08f78cf782eb6832309520af15e 100644 --- a/internal/tui/exp/list/list.go +++ b/internal/tui/exp/list/list.go @@ -859,7 +859,7 @@ func (l *list[T]) calculateItemPositions() { currentHeight := 0 // Always calculate positions in forward order (logical positions) - for i := 0; i < itemsLen; i++ { + for i := range itemsLen { item, ok := l.items.Get(i) if !ok { continue @@ -1498,9 +1498,13 @@ func (l *list[T]) reset(selectedItemID string) tea.Cmd { // SetSize implements List. func (l *list[T]) SetSize(width int, height int) tea.Cmd { - oldWidth := l.width - l.width = width - l.height = height + oldWidth, oldHeight := l.width, l.height + l.width, l.height = width, height + if oldWidth != width || oldHeight != height { + l.renderMu.Lock() + l.rendered = l.renderVirtualScrolling() + l.renderMu.Unlock() + } if oldWidth != width { // Get current selected item ID to preserve selection var selectedID string