summaryrefslogtreecommitdiff
path: root/plugins/NewStory/src/history_control.cpp
diff options
context:
space:
mode:
Diffstat (limited to 'plugins/NewStory/src/history_control.cpp')
-rw-r--r--plugins/NewStory/src/history_control.cpp8
1 files changed, 5 insertions, 3 deletions
diff --git a/plugins/NewStory/src/history_control.cpp b/plugins/NewStory/src/history_control.cpp
index c997419ae2..f62e85491e 100644
--- a/plugins/NewStory/src/history_control.cpp
+++ b/plugins/NewStory/src/history_control.cpp
@@ -603,17 +603,19 @@ int NewstoryListData::PaintItem(HDC hdc, int index, int top, int width)
void NewstoryListData::RecalcScrollBar()
{
+ if (totalCount == 0)
+ return;
+
SCROLLINFO si = {};
si.cbSize = sizeof(si);
si.fMask = SIF_ALL;
si.nMin = 0;
si.nMax = totalCount-1;
- si.nPage = 10;
+ si.nPage = (totalCount <= 10) ? totalCount - 1 : 10;
si.nPos = scrollTopItem;
- if (cachedScrollbarPage != si.nPage || si.nPos != cachedScrollbarPos) {
+ if (si.nPos != cachedScrollbarPos) {
cachedScrollbarPos = si.nPos;
- cachedScrollbarPage = si.nPage;
SetScrollInfo(m_hwnd, SB_VERT, &si, TRUE);
}
}