From 7c5ae27a76b6f8b7afe556decdc3543ed90f94eb Mon Sep 17 00:00:00 2001 From: George Hazan Date: Fri, 11 Aug 2023 11:51:01 +0300 Subject: =?UTF-8?q?fixes=20#3637=20(NewStory:=20=D1=83=D0=B4=D0=B0=D0=BB?= =?UTF-8?q?=D0=B5=D0=BD=D0=B8=D0=B5=20=D1=81=D0=B0=D0=BC=D0=BE=D0=B3=D0=BE?= =?UTF-8?q?=20=D0=BD=D0=BE=D0=B2=D0=BE=D0=B3=D0=BE=20=D1=81=D0=BE=D0=BE?= =?UTF-8?q?=D0=B1=D1=89=D0=B5=D0=BD=D0=B8=D1=8F=20=D0=BE=D1=81=D1=82=D0=B0?= =?UTF-8?q?=D0=B2=D0=BB=D1=8F=D0=B5=D1=82=20=D0=B4=D1=8B=D1=80=D0=BA=D1=83?= =?UTF-8?q?)?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- plugins/NewStory/src/history_control.cpp | 6 ++++-- plugins/NewStory/src/history_control.h | 2 +- 2 files changed, 5 insertions(+), 3 deletions(-) (limited to 'plugins/NewStory') diff --git a/plugins/NewStory/src/history_control.cpp b/plugins/NewStory/src/history_control.cpp index c54275d04c..7856c005bf 100644 --- a/plugins/NewStory/src/history_control.cpp +++ b/plugins/NewStory/src/history_control.cpp @@ -172,6 +172,7 @@ void NewstoryListData::DeleteItems(void) if (firstSel != -1) { SetCaret(firstSel, false); SetSelection(firstSel, firstSel); + FixScrollPosition(true); } } @@ -243,7 +244,7 @@ void NewstoryListData::EnsureVisible(int item) FixScrollPosition(); } -void NewstoryListData::FixScrollPosition() +void NewstoryListData::FixScrollPosition(bool bForce) { EndEditItem(false); @@ -251,7 +252,7 @@ void NewstoryListData::FixScrollPosition() GetWindowRect(hwnd, &rc); int windowHeight = rc.bottom - rc.top; - if (windowHeight != cachedWindowHeight || cachedMaxTopItem != scrollTopItem) { + if (bForce || windowHeight != cachedWindowHeight || cachedMaxTopItem != scrollTopItem) { int maxTopItem = totalCount, tmp = 0; while (maxTopItem > 0 && tmp < windowHeight) tmp += GetItemHeight(--maxTopItem); @@ -767,6 +768,7 @@ LRESULT CALLBACK NewstoryListWndProc(HWND hwnd, UINT msg, WPARAM wParam, LPARAM if (idx != -1) { data->items.remove(idx); data->totalCount--; + data->FixScrollPosition(true); InvalidateRect(hwnd, 0, FALSE); } break; diff --git a/plugins/NewStory/src/history_control.h b/plugins/NewStory/src/history_control.h index 9cd9e9d782..cb653364a5 100644 --- a/plugins/NewStory/src/history_control.h +++ b/plugins/NewStory/src/history_control.h @@ -98,7 +98,7 @@ struct NewstoryListData : public MZeroedObject void DeleteItems(void); void EndEditItem(bool bAccept); void EnsureVisible(int item); - void FixScrollPosition(); + void FixScrollPosition(bool bForce = false); ItemData* GetItem(int idx); int GetItemFromPixel(int yPos); int GetItemHeight(int index); -- cgit v1.2.3