diff --git a/internal/ui/list/list.go b/internal/ui/list/list.go index 32a8e661a5caaba2c8f36235eb554a2044ee14e0..f6c3fdc44501923f37a1943fa69d4432a6d4720c 100644 --- a/internal/ui/list/list.go +++ b/internal/ui/list/list.go @@ -84,6 +84,10 @@ func (l *List) AtBottom() bool { // Calculate the height from offsetIdx to the end. var totalHeight int for idx := l.offsetIdx; idx < len(l.items); idx++ { + if totalHeight > l.height { + // No need to calculate further, we're already past the viewport height + return false + } item := l.getItem(idx) itemHeight := item.height if l.gap > 0 && idx > l.offsetIdx {