From d92bc4c8184313d4963bce815b8c50c33684d07d Mon Sep 17 00:00:00 2001 From: George Hazan Date: Fri, 18 Aug 2023 14:12:27 +0300 Subject: NewStory: if we manually scrolled log up, don't let it move back to the bottom on a new event --- plugins/NewStory/src/history_control.cpp | 8 +++++++- plugins/NewStory/src/history_control.h | 2 +- 2 files changed, 8 insertions(+), 2 deletions(-) (limited to 'plugins/NewStory/src') diff --git a/plugins/NewStory/src/history_control.cpp b/plugins/NewStory/src/history_control.cpp index fc5adebd39..689ac81d71 100644 --- a/plugins/NewStory/src/history_control.cpp +++ b/plugins/NewStory/src/history_control.cpp @@ -84,7 +84,9 @@ void NewstoryListData::OnTimer(CTimer *pTimer) { pTimer->Stop(); - EnsureVisible(totalCount - 1); + if (bWasAtBottom) + EnsureVisible(totalCount - 1); + InvalidateRect(hwnd, 0, FALSE); } @@ -128,6 +130,9 @@ void NewstoryListData::AddSelection(int iFirst, int iLast) bool NewstoryListData::AtBottom(void) const { + if (cachedMaxDrawnItem == -1) + return true; + if (cachedMaxDrawnItem > totalCount) return true; @@ -475,6 +480,7 @@ void NewstoryListData::RecalcScrollBar() void NewstoryListData::ScheduleDraw() { + bWasAtBottom = AtBottom(); redrawTimer.Stop(); redrawTimer.Start(30); } diff --git a/plugins/NewStory/src/history_control.h b/plugins/NewStory/src/history_control.h index f557d9c694..5bafeaa727 100644 --- a/plugins/NewStory/src/history_control.h +++ b/plugins/NewStory/src/history_control.h @@ -61,7 +61,7 @@ struct NewstoryListData : public MZeroedObject RECT rcLastPaint; - bool bWasShift, bSortAscending, hasData; + bool bWasShift, bSortAscending, hasData, bWasAtBottom; HWND hwnd; HWND hwndEditBox; -- cgit v1.2.3