Release v0.6.44: select newest item when opening clipboard history
This commit is contained in:
1 parent
6621a49022
commit
90b2e0841f
9 files changed
+44
-17
No files matched your search
+13
@@ -493,6 +493,7 @@ struct HistoryView
|
||||
std::set<std::wstring> pending;
|
||||
bool scrolling{};
|
||||
bool closed{};
|
||||
bool selectFirstOnResults{};
|
||||
};
|
||||
bool selectedImage(HWND w, HistoryView *v)
|
||||
{
|
||||
@@ -816,6 +817,14 @@ LRESULT CALLBACK historyProc(HWND w, UINT msg, WPARAM wp, LPARAM lp)
|
||||
int top=(int)SendDlgItemMessageW(w,102,LB_GETTOPINDEX,0,0);
|
||||
auto topId=top>=0 && top<(int)v->items.size()?v->items[top].id:L"";
|
||||
if (topId.empty()) topId = v->rememberedTop;
|
||||
if (v->selectFirstOnResults)
|
||||
{
|
||||
old.clear();
|
||||
topId.clear();
|
||||
v->rememberedSelection.clear();
|
||||
v->rememberedTop.clear();
|
||||
v->selectFirstOnResults = false;
|
||||
}
|
||||
v->items = std::move(result->items);
|
||||
SendDlgItemMessageW(w, 102, WM_SETREDRAW, FALSE, 0);
|
||||
SendDlgItemMessageW(w, 102, LB_RESETCONTENT, 0, 0);
|
||||
@@ -1771,6 +1780,10 @@ void showHistory(App &app, bool visible)
|
||||
}
|
||||
}
|
||||
if (!visible) return;
|
||||
// A fresh invocation starts at the newest matching item. Background search
|
||||
// and OCR refreshes still preserve the user's selection while browsing.
|
||||
auto *view = (HistoryView *)GetWindowLongPtrW(app.historyWindow, GWLP_USERDATA);
|
||||
view->selectFirstOnResults = true;
|
||||
POINT cursor;
|
||||
GetCursorPos(&cursor);
|
||||
MONITORINFO monitor{sizeof(monitor)};
|
||||
|
||||
Reference in new issue
Block a user