From f3b3e4ccf25f1a6345cb07db6ebdbe2658ba7b27 Mon Sep 17 00:00:00 2001 From: George Hazan Date: Thu, 21 Nov 2024 18:04:05 +0300 Subject: =?UTF-8?q?fixes=20#4609=20(NewStory:=20=D1=81=D0=BA=D1=80=D0=BE?= =?UTF-8?q?=D0=BB=D0=BB=D0=B1=D0=B0=D1=80=20=D0=BA=D0=BE=D0=BB=D0=B1=D0=B0?= =?UTF-8?q?=D1=81=D0=B8=D1=82)?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- plugins/NewStory/src/history_control.cpp | 13 ++++++++++--- 1 file changed, 10 insertions(+), 3 deletions(-) (limited to 'plugins/NewStory') diff --git a/plugins/NewStory/src/history_control.cpp b/plugins/NewStory/src/history_control.cpp index d3ee3d07b1..9887f00e01 100644 --- a/plugins/NewStory/src/history_control.cpp +++ b/plugins/NewStory/src/history_control.cpp @@ -914,22 +914,29 @@ void NewstoryListData::RecalcScrollBar() if (totalCount == 0) return; - int yTotal = 0, yTop = 0, numRec = 0; + int yTotal = 0, yTop = 0, yVis = 0, numRec = 0; for (int i = 0; i < totalCount; i++) { if (i == scrollTopItem) yTop = yTotal - scrollTopPixel; auto *pItem = GetItem(i); if (pItem->m_bLoaded) { - yTotal += GetItemHeight(pItem); numRec++; + + int iHeight = GetItemHeight(pItem); + yTotal += iHeight; + if (i >= scrollTopItem) + yVis += iHeight; } } if (numRec != totalCount) { double averageH = double(yTotal) / double(numRec); yTotal = totalCount * averageH; - yTop = scrollTopItem * averageH; + if (cachedMaxDrawnItem == totalCount - 1) + yTop = yTotal - ((scrollTopItem == 0) ? yVis : cachedWindowHeight); + else + yTop = scrollTopItem * averageH; } SCROLLINFO si = {}; -- cgit v1.2.3