summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorGeorge Hazan <george.hazan@gmail.com>2023-08-23 19:54:48 +0300
committerGeorge Hazan <george.hazan@gmail.com>2023-08-23 19:54:48 +0300
commita2a4133668be66d7a1fe8624c0fe1148b27777b7 (patch)
treecadf50de469039c22452924a0eb3f9caa2c87922
parentabacfceb23fc41d0b632a7985c2291c02225b432 (diff)
fixes #3657 (NewStory: снятие выделения)
-rw-r--r--plugins/NewStory/src/history_control.cpp18
1 files changed, 11 insertions, 7 deletions
diff --git a/plugins/NewStory/src/history_control.cpp b/plugins/NewStory/src/history_control.cpp
index 34dd45fe0d..90feb511e4 100644
--- a/plugins/NewStory/src/history_control.cpp
+++ b/plugins/NewStory/src/history_control.cpp
@@ -209,15 +209,13 @@ void NewstoryListData::Clear()
void NewstoryListData::ClearSelection(int iFirst, int iLast)
{
- int start = min(totalCount - 1, iFirst);
- int end = min(totalCount - 1, max(0, iLast));
+ int start = min(0, iFirst);
+ int end = (iLast <= 0) ? totalCount - 1 : iLast;
if (start > end)
std::swap(start, end);
- for (int i = start; i <= end; ++i) {
- auto *p = GetItem(i);
- p->m_bSelected = false;
- }
+ for (int i = start; i <= end; ++i)
+ GetItem(i)->m_bSelected = false;
InvalidateRect(hwnd, 0, FALSE);
}
@@ -555,7 +553,7 @@ void NewstoryListData::SetSelection(int iFirst, int iLast)
int count = totalCount;
for (int i = 0; i < count; ++i) {
auto *p = GetItem(i);
- if ((i >= start) && (i <= end))
+ if (i >= start && i <= end)
p->m_bSelected = true;
else
p->m_bSelected = false;
@@ -904,6 +902,12 @@ LRESULT CALLBACK NewstoryListWndProc(HWND hwnd, UINT msg, WPARAM wParam, LPARAM
}
break;
+ case WM_KILLFOCUS:
+ data->EndEditItem(false);
+ if (data->pMsgDlg)
+ data->ClearSelection(0, -1);
+ return 0;
+
case WM_SETFOCUS:
return 0;