diff options
author | George Hazan <george.hazan@gmail.com> | 2023-08-11 11:51:01 +0300 |
---|---|---|
committer | George Hazan <george.hazan@gmail.com> | 2023-08-11 11:51:01 +0300 |
commit | 7c5ae27a76b6f8b7afe556decdc3543ed90f94eb (patch) | |
tree | d47a2f29ea4ddf466f5cc9b1ceeed8a9ff187465 /plugins/NewStory/src | |
parent | 9fe75dcbc4651f828830f8ee65f2d9e352627aba (diff) |
fixes #3637 (NewStory: удаление самого нового сообщения оставляет дырку)
Diffstat (limited to 'plugins/NewStory/src')
-rw-r--r-- | plugins/NewStory/src/history_control.cpp | 6 | ||||
-rw-r--r-- | plugins/NewStory/src/history_control.h | 2 |
2 files changed, 5 insertions, 3 deletions
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); |