diff options
-rw-r--r-- | plugins/NewStory/src/history_control.cpp | 8 | ||||
-rw-r--r-- | plugins/NewStory/src/history_control.h | 1 |
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; |