From 3f72dde918a1180adb23ff4e0041fe3f149d8aaa Mon Sep 17 00:00:00 2001 From: 2 * r + 2 * t <61896496+soramanew@users.noreply.github.com> Date: Thu, 9 Apr 2026 17:49:03 +1000 Subject: [PATCH] fix: lazy list view overshoot --- plugin/src/Caelestia/Components/lazylistview.cpp | 16 ++++++++++++++-- 1 file changed, 14 insertions(+), 2 deletions(-) diff --git a/plugin/src/Caelestia/Components/lazylistview.cpp b/plugin/src/Caelestia/Components/lazylistview.cpp index d05ca095..14fb4bb8 100644 --- a/plugin/src/Caelestia/Components/lazylistview.cpp +++ b/plugin/src/Caelestia/Components/lazylistview.cpp @@ -492,10 +492,22 @@ void LazyListView::relayout() { } QRectF LazyListView::effectiveViewport() const { + QRectF vp; if (m_useCustomViewport) - return m_viewport.adjusted(0, -m_cacheBuffer, 0, m_cacheBuffer); + vp = m_viewport; + else + vp = QRectF(0, m_contentY, width(), height()); - return QRectF(0, m_contentY - m_cacheBuffer, width(), height() + 2 * m_cacheBuffer); + // During Flickable overshoot the viewport can extend entirely beyond content bounds, + // causing all delegates to be culled. Clamp so it always overlaps [0, layoutHeight]. + if (m_layoutHeight > 0) { + const qreal top = std::min(vp.y(), m_layoutHeight); + const qreal bottom = std::max(vp.y() + vp.height(), 0.0); + if (bottom > top) + vp = QRectF(vp.x(), top, vp.width(), bottom - top); + } + + return vp.adjusted(0, -m_cacheBuffer, 0, m_cacheBuffer); } std::pair LazyListView::computeVisibleRange() const {