diff options
Diffstat (limited to 'plugins/NewStory/src/history_control.cpp')
-rw-r--r-- | plugins/NewStory/src/history_control.cpp | 13 |
1 files changed, 11 insertions, 2 deletions
diff --git a/plugins/NewStory/src/history_control.cpp b/plugins/NewStory/src/history_control.cpp index 7b49f59d70..d62a0cb892 100644 --- a/plugins/NewStory/src/history_control.cpp +++ b/plugins/NewStory/src/history_control.cpp @@ -432,7 +432,7 @@ void NewstoryListData::FixScrollPosition(bool bForce) } } -ItemData* NewstoryListData::GetItem(int idx) +ItemData* NewstoryListData::GetItem(int idx) const { if (totalCount == 0) return nullptr; @@ -491,6 +491,15 @@ int NewstoryListData::GetItemHeight(int index) return item->savedHeight = sz.cy + 5; } +bool NewstoryListData::HasSelection() const +{ + for (int i = 0; i < totalCount; i++) + if (auto *p = GetItem(i)) + return true; + + return false; +} + ItemData* NewstoryListData::LoadItem(int idx) { if (totalCount == 0) @@ -894,7 +903,7 @@ LRESULT CALLBACK NewstoryListWndProc(HWND hwnd, UINT msg, WPARAM wParam, LPARAM if (data->caret != idx) data->EndEditItem(false); data->SetCaret(idx); - if (data->selStart == -1) + if (!data->HasSelection()) data->SetSelection(idx, idx); data->OnContextMenu(idx, pt); } |