summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorGeorge Hazan <george.hazan@gmail.com>2023-12-01 19:25:00 +0300
committerGeorge Hazan <george.hazan@gmail.com>2023-12-01 19:25:00 +0300
commit8191a159edbc5d6245616c5a25d6b8f95b3f8a1a (patch)
treeb4e067d9f14341dcf322b672b29f6c4b23cb5cdd
parentf90ab8dd3ec8e113b4e05e5f3ec940c04a22ccbe (diff)
fixes #3997 (NewStory: scrollbar does not appear when the window is reduced in size)
-rw-r--r--plugins/NewStory/src/history_control.cpp8
-rw-r--r--plugins/NewStory/src/history_control.h1
2 files changed, 5 insertions, 4 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);
}
}
diff --git a/plugins/NewStory/src/history_control.h b/plugins/NewStory/src/history_control.h
index 2cbe46309c..85bc06f2aa 100644
--- a/plugins/NewStory/src/history_control.h
+++ b/plugins/NewStory/src/history_control.h
@@ -18,7 +18,6 @@ struct NewstoryListData : public MZeroedObject
int cachedWindowWidth = -1, cachedWindowHeight = -1;
int cachedMaxDrawnItem = -1;
int cachedScrollbarPos = -1;
- unsigned int cachedScrollbarPage = -1;
int totalCount;
RECT rcLastPaint;