Release v0.6.44: select newest item when opening clipboard history

This commit is contained in:
2026-11-05 00:15:54 +02:00
parent 6621a49022
commit 7812956da3
9 changed files with 44 additions and 17 deletions
+1 -1
View File
@@ -1,5 +1,5 @@
cmake_minimum_required(VERSION 3.24)
project(KSwitcher VERSION 0.6.43 LANGUAGES CXX RC)
project(KSwitcher VERSION 0.6.44 LANGUAGES CXX RC)
if(NOT WIN32)
message(FATAL_ERROR "KSwitcher uses native Windows APIs")
endif()
+1 -1
View File
@@ -737,7 +737,7 @@ Check **★ Pinned only** beside the history search box to show only pinned entr
### History process and clipboard memory — v0.6.40
History opens in a separate, short-lived instance of **KSwitcher.exe**. **Esc** closes it even when focus is on the window or an action button, releasing Windows UI allocations with the process. The resident keeps keyboard hooks, clipboard capture and history storage. Search, selection and the top entry are preserved in encrypted view state. If a full-text item viewer is still open, the helper stays alive until the last viewer closes. Pin/delete, formatted/plain paste and OCR remain available; settings and default shortcuts are unchanged.
History opens in a separate, short-lived instance of **KSwitcher.exe**. **Esc** closes it even when focus is on the window or an action button, releasing Windows UI allocations with the process. The resident keeps keyboard hooks, clipboard capture and history storage. Search and the pinned-only filter are preserved in encrypted view state. Each fresh opening selects and reveals the newest matching entry; background refreshes preserve the selected record while browsing. If a full-text item viewer is still open, the helper stays alive until the last viewer closes. Pin/delete, formatted/plain paste and OCR remain available; settings and default shortcuts are unchanged.
Image thumbnails are decoded in **KSwitcher.Screenshot.exe**, returning only bounded preview pixels. Image clipboard backup/restore also uses that helper and encrypted temporary files, with clipboard-sequence checks before restoring. Selection reads avoid loading image formats. Keep all three executables together; no fourth executable is required. Paste allows a brief foreground handoff after history closes while preserving cancellation checks. UI Automation remains in the resident.
Binary file not shown.
+7 -10
View File
@@ -1,21 +1,18 @@
# Latest Windows release
## v0.6.43 — 2026-11-04
## v0.6.44 — 2026-11-05
## Changes
- Respect downstream keyboard-hook suppression before tracking input or starting snippets. This prevents source-side expansion of keys forwarded by Mouse Without Borders. Update KSwitcher on both computers, especially the keyboard-sharing source.
- Verify snippet selection and pasted text through accessibility even with logging disabled. Unavailable verification, incorrect text or clipboard changes cancel further cursor/Enter actions. No snippet syntax, shortcut or default changed.
- Accept identical clipboard relays only after observing target-owned content, preserving text and editor selection metadata checks. Unicode allocation padding and format order do not cause false mismatches; changed content remains rejected.
- Retry clipboard snapshots interrupted by concurrent publication up to three times before selection, while input context remains unchanged.
- Clicking a warning notification opens Logs. Copy rejection diagnostics include observed/current text, clipboard sequences and the sentinel for troubleshooting.
- Opening clipboard history selects and reveals the newest matching entry instead of restoring an older selection. This fixes reopening history after recording a new screenshot.
- Search and the pinned-only filter remain saved. Clear the search and uncheck **★ Pinned only** if the new screenshot is hidden.
- Background clipboard/OCR refreshes preserve the selected record while browsing. Invoking the history shortcut while history is already active retains its existing quick-paste behavior.
- No shortcuts, settings, capture behavior or storage format changed.
## Validation
Release regression checks cover dictionary equivalence (140,939 words), 105 sync checks, 319 native checks, 569 input checks, screenshot UI/save/registration, 48 updater checks and updater progress UI. The isolated snippet suite exercises an actual downstream forwarding hook, verifies no source-side copy or text changes, and checks normal expansion, Enter, buffered typing, copy retries and suppression of Enter after incorrect pasted text.
Live two-computer validation with both instances updated remains outstanding. An older instance on either computer can still interfere; the fix does not accept unrelated clipboard contents.
Passed dictionary equivalence checks for 140,939 words, 105 sync checks, shared wheel regressions, 319 native checks, 574 input checks, screenshot editor UI/save/registration, 48 updater checks and updater progress UI checks. The history regression covers reopening after a new image and preserving an explicitly selected older record during background refresh.
## Upgrade
Choose **Update** in the tray menu on both computers. Legacy v0.3.0–v0.4.1 clients first receive the v0.4.2 compatibility bridge, then the current full release. v0.2.3 and earlier require manual installation.
Choose **Update** in the tray menu. Legacy v0.3.0–v0.4.1 clients first receive the v0.4.2 compatibility bridge, then the current full release. v0.2.3 and earlier require manual installation.
For manual installation, exit KSwitcher, close its configurator and screenshot editors, and extract the entire ZIP into its installation folder. Keep personal `data/` and customized dictionaries.
Download **KSwitcher-win-x64.zip** with **SHA256SUMS.txt**. Keep all three executables together; history uses another instance of KSwitcher.exe. The package contains no personal settings, credentials or clipboard history.
+1 -1
View File
@@ -1 +1 @@
008f34a2a4a875acb07d21a39c0fad3a0cb63371edbcb91d393edf72543aea5e KSwitcher-win-x64.zip
a3e8a42db787ab5b8edca698fc97943a3e0d5348c5000cc632aeb07179210469 KSwitcher-win-x64.zip
+3 -3
View File
@@ -9,8 +9,8 @@ IDC_SCREENSHOT_PENCIL CURSOR "icons/lucide/pencil.cur"
1 RT_MANIFEST "app.manifest"
201 RCDATA "update.ps1"
1 VERSIONINFO
FILEVERSION 0,6,43,0
PRODUCTVERSION 0,6,43,0
FILEVERSION 0,6,44,0
PRODUCTVERSION 0,6,44,0
FILEOS VOS_NT_WINDOWS32
FILETYPE VFT_APP
BEGIN
@@ -20,7 +20,7 @@ BEGIN
BEGIN
VALUE "FileDescription", "KSwitcher — native keyboard and clipboard utility"
VALUE "ProductName", "KSwitcher"
VALUE "FileVersion", "0.6.43"
VALUE "FileVersion", "0.6.44"
END
END
BLOCK "VarFileInfo"
+13
View File
@@ -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)};
+1 -1
View File
@@ -2,7 +2,7 @@
#include "platform.h"
namespace ks
{
inline constexpr wchar_t AppVersion[] = L"0.6.43";
inline constexpr wchar_t AppVersion[] = L"0.6.44";
inline constexpr UINT UpdateMessage = WM_APP + 7;
inline constexpr UINT UpdateCheckIntervalMs = 6 * 60 * 60 * 1000;
inline constexpr UINT UpdateNotificationRetryMs = 5 * 60 * 1000;
+17
View File
@@ -2,6 +2,7 @@
#include "ui_scroll.h"
#include "ui_geometry.h"
#include "screenshot.h"
#include "ocr.h"
#include <commctrl.h>
#include <iostream>
#include <cmath>
@@ -980,6 +981,22 @@ int main(int argc, char **argv) {
require(pumpUntil(2),"history reloads after releasing hidden rows");
require(SendDlgItemMessageW(history,102,LB_GETCURSEL,0,0)==1,
"history retains selected record across close and reload");
SendMessageW(history,WM_CLOSE,0,0);
ks::Pixels screenshot{2,2,ks::Bytes(16,255)};
app.history->add(ks::Clip{{ks::imageDib(screenshot)}},L"screenshot",app.settings);
require(app.history->entries().front().image,"new screenshot is the newest history entry");
ks::showHistory(app);
require(pumpUntil(3),"reopening history loads the new screenshot");
require(SendDlgItemMessageW(history,102,LB_GETCURSEL,0,0)==0 &&
SendDlgItemMessageW(history,102,LB_GETTOPINDEX,0,0)==0,
"fresh history invocation selects and reveals newest screenshot instead of saved selection");
SendDlgItemMessageW(history,102,LB_SETCURSEL,2,0);
app.history->add(ks::textClip(L"background clipboard update"),L"test",app.settings);
ks::refreshHistory(app);
require(pumpUntil(4),"background refresh loads a new item");
require(SendDlgItemMessageW(history,102,LB_GETCURSEL,0,0)==3,
"background refresh preserves the selected record while browsing");
ShowWindow(history,SW_HIDE);
}
auto childRect=[&](int id) { RECT r{}; GetWindowRect(GetDlgItem(history,id),&r); MapWindowPoints(nullptr,history,(POINT*)&r,2); return r; };
RECT historyFrame{}; GetWindowRect(history,&historyFrame);