From de9fd29d5d3d932057f4d27eb994391aebe4357b Mon Sep 17 00:00:00 2001 From: Anatolii Hrynchuk Date: Mon, 16 Nov 2026 15:06:47 +0200 Subject: [PATCH 1/2] Add search to the rendered Markdown viewer Refs #38 --- CMakeLists.txt | 2 +- FILES-UI.md | 4 + Release/README.md | 6 ++ resources/app.rc | 6 +- resources/terminal/markdown.html | 18 ++++- resources/terminal/markdown.js | 123 ++++++++++++++++++++++++++++++- src/files_text_window.cpp | 26 ++++++- src/update.h | 2 +- tests/files_markdown.ps1 | 9 +++ tests/files_markdown_browser.mjs | 72 +++++++++++++++++- 10 files changed, 253 insertions(+), 15 deletions(-) diff --git a/CMakeLists.txt b/CMakeLists.txt index 8729c5d..22456c2 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -1,5 +1,5 @@ cmake_minimum_required(VERSION 3.24) -project(KSwitcher VERSION 0.6.103 LANGUAGES CXX RC) +project(KSwitcher VERSION 0.6.104 LANGUAGES CXX RC) if(NOT WIN32) message(FATAL_ERROR "KSwitcher uses native Windows APIs") endif() diff --git a/FILES-UI.md b/FILES-UI.md index b589ce8..3291e42 100644 --- a/FILES-UI.md +++ b/FILES-UI.md @@ -170,6 +170,10 @@ Warning і початковий фокус на No. Звичайний клік відкриває внутрішнє посилання в тому самому вікні, Shift+клік відкриває окреме вікно. Назад і вперед працюють через стрілки перегляду, бічні кнопки миші й Alt+←/→. Ctrl+W закриває перегляд. + Ctrl+F або кнопка пошуку відкриває пошук у відрендерованому документі. + Пошук без урахування регістру показує кількість збігів і підсвічує поточний. + Enter і F3 переходять до наступного збігу, а Shift+Enter і Shift+F3 — до + попереднього, циклічно. Escape спочатку закриває поле пошуку. Коли локальний Markdown оновлюється на диску, відкритий перегляд перерендерюється зі збереженням позиції прокрутки. Вебпосилання HTTP і HTTPS відкриваються в системному браузері. diff --git a/Release/README.md b/Release/README.md index d50350c..ac09c82 100644 --- a/Release/README.md +++ b/Release/README.md @@ -1,5 +1,11 @@ # Latest Windows release +## v0.6.104 — 2026-11-16 + +**Ctrl+F** or the search icon opens search in the rendered KSwitcher Files Markdown preview. Search ignores case and highlights the current match. **Enter** or **F3** moves to the next match, and **Shift+Enter** or **Shift+F3** moves back. **Escape** closes the search first. This release includes the HTML, Markdown appearance, Options and terminal copy updates from v0.6.103. + +**Українською.** **Ctrl+F** або піктограма пошуку відкриває пошук у відрендерованому Markdown у KSwitcher Files. Пошук ігнорує регістр і підсвічує поточний збіг. **Enter** або **F3** переходить до наступного збігу, а **Shift+Enter** або **Shift+F3** повертає до попереднього. **Escape** спочатку закриває пошук. Реліз включає підтримку HTML, налаштування вигляду Markdown, запам’ятовування розділу Options і копіювання з термінала з v0.6.103. + ## v0.6.103 — 2026-11-16 The KSwitcher Files Markdown preview renders embedded HTML tables and inline styles such as `white-space: nowrap`. **Options → Viewer → Markdown** sets the preview width, font family and font size. Files Options reopens the last section. **Ctrl+C** and **Ctrl+Insert** copy selected terminal output. This release replaces v0.6.102. diff --git a/resources/app.rc b/resources/app.rc index 4d93e14..a8c070a 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,103,0 - PRODUCTVERSION 0,6,103,0 + FILEVERSION 0,6,104,0 + PRODUCTVERSION 0,6,104,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.103" + VALUE "FileVersion", "0.6.104" END END BLOCK "VarFileInfo" diff --git a/resources/terminal/markdown.html b/resources/terminal/markdown.html index bd7a017..5cf91d2 100644 --- a/resources/terminal/markdown.html +++ b/resources/terminal/markdown.html @@ -9,12 +9,18 @@ :root:not(.rendered) body { visibility: hidden; } body { max-width: var(--markdown-width, 960px); margin: auto; padding: 20px 28px; overflow-wrap: anywhere; } main { font: var(--markdown-font-size, 12pt)/1.55 var(--markdown-font, system-ui, sans-serif); } -nav { position: sticky; top: 0; display: flex; gap: .4em; padding-block: .25em; background: Canvas; } +nav { position: sticky; top: 0; display: flex; flex-wrap: wrap; gap: .4em; padding-block: .25em; background: Canvas; } nav button { appearance: none; border: 0; background: transparent; color: LinkText; font: 1.35em/1.25 system-ui, sans-serif; min-width: 1.55em; padding: 0; cursor: pointer; } nav button:disabled { color: GrayText; opacity: .6; cursor: default; } nav button:hover:not(:disabled) { text-decoration: underline; } nav button:focus-visible { outline: 2px solid currentColor; outline-offset: 2px; } +#search { margin-inline-start: auto; display: flex; align-items: center; gap: .35em; + flex: 0 1 22em; min-width: 0; max-width: 100%; } +#search[hidden] { display: none; } +#search-query { box-sizing: border-box; flex: 1; min-width: 0; width: 0; font: inherit; } +#search-status { white-space: nowrap; font-size: .8em; } +::highlight(markdown-search-active) { background: #ffab45; color: #171717; } :is(h1,h2,h3,h4,h5,h6) { scroll-margin-top: 2.5em; } h1, h2 { border-bottom: 1px solid GrayText; padding-bottom: .25em; } a { color: LinkText; } @@ -31,9 +37,17 @@ figure { margin: 1em 0; } .task { list-style: none; } .task input { margin-inline: -1.15em .4em; cursor: pointer; } -