diff --git a/CMakeLists.txt b/CMakeLists.txt index 558f2e7..61fc320 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -1,5 +1,5 @@ cmake_minimum_required(VERSION 3.24) -project(KSwitcher VERSION 0.6.70 LANGUAGES CXX RC) +project(KSwitcher VERSION 0.6.71 LANGUAGES CXX RC) if(NOT WIN32) message(FATAL_ERROR "KSwitcher uses native Windows APIs") endif() diff --git a/README.md b/README.md index e279d69..43bb63c 100644 --- a/README.md +++ b/README.md @@ -445,6 +445,11 @@ Recognition uses Chrome accessibility: the address bar and active document must ### Snippet autocomplete — v0.6.69 +Starting with v0.6.71, **Enter** accepts a suggestion after you navigate +the list with **↑ / ↓**. Without arrow navigation, **Enter** goes to the +editor. З v0.6.71 **Enter** після вибору стрілками вставляє сніпет. Без +переміщення списком **Enter** надходить до редактора. + Starting with v0.6.70, suggestions open at the text caret. If the editor provides no caret position, you can still type the complete trigger to expand the snippet. diff --git a/Release/KSwitcher-win-x64.zip b/Release/KSwitcher-win-x64.zip index 57b6c3f..f723518 100644 Binary files a/Release/KSwitcher-win-x64.zip and b/Release/KSwitcher-win-x64.zip differ diff --git a/Release/README.md b/Release/README.md index f15b615..ffacd6d 100644 --- a/Release/README.md +++ b/Release/README.md @@ -1,5 +1,24 @@ # Latest Windows release +## v0.6.71 — 2026-11-12 + +After navigating snippet suggestions with **↑ / ↓**, press **Enter** to +insert the selected snippet and close the list. The editor does not receive +that keypress. If you have not navigated the list, **Enter** still goes to +the editor. **Tab** and mouse selection also work. + +KSwitcher skips suggestions when VS Code's EditContext supplies the bounds +of the whole line in place of the text caret. See the [FAQ](https://gitea.hrynco.com/hrynco/hrynco-kswitcher/wiki/FAQ) +for the VS Code workaround. + +**Українською.** Після вибору підказки клавішами **↑ / ↓** натисніть +**Enter**, щоб вставити сніпет і закрити список. Редактор не отримує це +натискання. Якщо ви не переміщалися списком, **Enter** і далі надходить +до редактора. Також можна вибрати сніпет через **Tab** або мишею. + +KSwitcher приховує підказки, коли EditContext у VS Code повертає координати +всього рядка замість текстового курсора. Обхідний шлях описано у [FAQ українською](https://gitea.hrynco.com/hrynco/hrynco-kswitcher/wiki/FAQ-uk). + ## v0.6.70 — 2026-11-12 Snippet suggestions are anchored to the text caret. KSwitcher uses the diff --git a/Release/SHA256SUMS.txt b/Release/SHA256SUMS.txt index c6924b2..10d91c4 100644 --- a/Release/SHA256SUMS.txt +++ b/Release/SHA256SUMS.txt @@ -1 +1 @@ -11928aed6d61b46940ee5d75d78a11d2f108029bbf456b8f3496bea929cda69e KSwitcher-win-x64.zip +42390860144e0b3a2b32874500ab9de8de60b76715cc583d306f761a749a83e9 KSwitcher-win-x64.zip diff --git a/Release/release-files.json b/Release/release-files.json index 903bc12..effa17d 100644 --- a/Release/release-files.json +++ b/Release/release-files.json @@ -1,21 +1,20 @@ { - "version": "0.6.70", - "schema": 1, + "version": "0.6.71", "files": [ { "size": 2202624, "path": "KSwitcher.exe", - "sha256": "9ccce3f66fdb60f03359fb39c91b55b386af1b138c977d8f9ed4c40faa63ff36" + "sha256": "fc85390dcc0a46c8cd10daad77482de4f374f9f61b4b4adee1a9ca022d17e4f8" }, { "size": 2129408, "path": "KSwitcher.Config.exe", - "sha256": "281dfbe20e432d766a7380355d96914811b03f077f4ced3e619d2bec980df18e" + "sha256": "371c9bf2673049e52f432457a929173f5e5a2a91d1e9dc3e96ef8a2c4699e628" }, { "size": 3210240, "path": "KSwitcher.Screenshot.exe", - "sha256": "fc868e659eaab5464a631f0e61aaa5cce81e7d134273bb3e9d4f0cecd73ce2fd" + "sha256": "bbcfed4d697c9053ff6ad828289805cd6d5f20b4c3d29027b4d26317b973f725" }, { "size": 4401, @@ -28,9 +27,9 @@ "sha256": "c0d068392ea65358b798b8c165103560f06e9e3b38c4ab4e2d8810a7b931af86" }, { - "size": 92352, + "size": 92710, "path": "README.md", - "sha256": "a0cbdbf4537b4f5066108828efc7caaf0e42fa7d539c3400a24ff8fda47244b4" + "sha256": "3d475635e3190c80dbf499bb06cb0c082c16c8977d735e21e8f658cc8fc2bc51" }, { "size": 9900, @@ -82,5 +81,6 @@ "path": "tools/StayHere-README.md", "sha256": "ba214e2aca7405e698b3ab21ceb1f41ce088edd996b3e30e4a9d58ff496f9413" } - ] + ], + "schema": 1 } diff --git a/resources/app.rc b/resources/app.rc index eae62a6..cb844e8 100644 --- a/resources/app.rc +++ b/resources/app.rc @@ -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,70,0 - PRODUCTVERSION 0,6,70,0 + FILEVERSION 0,6,71,0 + PRODUCTVERSION 0,6,71,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.70" + VALUE "FileVersion", "0.6.71" END END BLOCK "VarFileInfo" diff --git a/src/app.cpp b/src/app.cpp index c3b95d5..fbdbf1e 100644 --- a/src/app.cpp +++ b/src/app.cpp @@ -1127,6 +1127,7 @@ void App::matchSnippets(HWND fg, bool expandExact) if (!snippetFocus) return; const auto selected = snippetMatches.empty() ? matches.end() : std::find(matches.begin(), matches.end(), snippetMatches[snippetSelection]); + if (selected == matches.end()) snippetNavigated = false; snippetSelection = selected == matches.end() ? 0 : static_cast(selected - matches.begin()); snippetMatches = std::move(matches); snippetPrefixLength = prefix.size(); @@ -1162,6 +1163,7 @@ bool App::snippetPopupCurrent() const void App::hideSnippetPopup() { snippetMatches.clear(); + snippetNavigated = false; if (snippetPopup && IsWindowVisible(snippetPopup)) { ShowWindow(snippetPopup, SW_HIDE); @@ -1268,15 +1270,17 @@ void App::selectSnippet(size_t row) } bool App::handleSnippetKey(DWORD vk, UINT mods) { - if (mods || (vk != VK_UP && vk != VK_DOWN && vk != VK_TAB && vk != VK_ESCAPE) || + const bool accept = vk == VK_TAB || (vk == VK_RETURN && snippetNavigated); + if (mods || (!accept && vk != VK_UP && vk != VK_DOWN && vk != VK_ESCAPE) || !snippetPopup || !IsWindowVisible(snippetPopup) || !snippetPopupCurrent()) return false; - if (vk == VK_TAB) selectSnippet(snippetSelection); + if (accept) selectSnippet(snippetSelection); else if (vk == VK_ESCAPE) hideSnippetPopup(); else { const auto count = snippetMatches.size(); snippetSelection = (snippetSelection + (vk == VK_DOWN ? 1 : count - 1)) % count; + snippetNavigated = true; InvalidateRect(snippetPopup, nullptr, FALSE); } return true; diff --git a/src/app.h b/src/app.h index fa380d2..62adc86 100644 --- a/src/app.h +++ b/src/app.h @@ -179,6 +179,7 @@ class App HWND snippetPopup{}, snippetTarget{}, snippetFocus{}; uint64_t snippetPopupVersion{}; size_t snippetPrefixLength{}, snippetSelection{}; + bool snippetNavigated{}; int snippetRowHeight{}; UINT snippetDpi{96}; RECT snippetPopupAnchor{}; diff --git a/src/update.h b/src/update.h index c506504..c15a5a9 100644 --- a/src/update.h +++ b/src/update.h @@ -2,7 +2,7 @@ #include "platform.h" namespace ks { -inline constexpr wchar_t AppVersion[] = L"0.6.70"; +inline constexpr wchar_t AppVersion[] = L"0.6.71"; inline constexpr UINT UpdateMessage = WM_APP + 7; inline constexpr UINT UpdateCheckIntervalMs = 6 * 60 * 60 * 1000; inline constexpr UINT UpdateNotificationRetryMs = 5 * 60 * 1000; diff --git a/tests/integration.cpp b/tests/integration.cpp index 4b113e2..62c6744 100644 --- a/tests/integration.cpp +++ b/tests/integration.cpp @@ -675,19 +675,33 @@ LRESULT CALLBACK procedure(HWND w, UINT msg, WPARAM wp, LPARAM lp) break; case 70: require(ks::InputRegressionAccess::suggestionsVisible(*app), "editing the prefix reopens suggestions"); - typeKeys({VK_UP, VK_TAB}); + enterPresses = 0; + typeKeys({VK_UP, VK_RETURN}); break; case 71: - require(text() == L"prefix second", "Up wraps to the last eligible snippet and Tab replaces only the prefix"); + require(text() == L"prefix second", "Up wraps to the last eligible snippet and Enter replaces only the prefix"); + require(enterPresses == 0 && !ks::InputRegressionAccess::suggestionsVisible(*app), + "confirming with Enter closes suggestions without sending Enter to the editor"); require(ks::readClipboard(app->window).text() == sentinel, "autocomplete restores the clipboard"); + prepare(L"prefix ", false); + typeKeys({VK_OEM_1, 'Q', 'Z'}); + break; + case 72: + require(ks::InputRegressionAccess::suggestionsVisible(*app), "suggestions reopen for a new prefix"); + typeKeys({VK_RETURN}); + break; + case 73: + require(enterPresses == 1 && text() == L"prefix ;qz\r\n" && + !ks::InputRegressionAccess::suggestionsVisible(*app), + "Enter without arrow navigation reaches the editor"); app->resetInput(); SetFocus(host); typeKeys({VK_OEM_1}); break; - case 72: + case 74: if (ks::InputRegressionAccess::findingSuggestionCaret(*app)) { - stage = 72; + stage = 74; break; } require(!ks::InputRegressionAccess::suggestionsVisible(*app),