Compare commits

...
13 changed files with 327 additions and 89 deletions

No files matched your search

+1 -1
View File
@@ -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()
+4
View File
@@ -170,6 +170,10 @@ Warning і початковий фокус на No.
Звичайний клік відкриває внутрішнє посилання в тому самому вікні,
Shift+клік відкриває окреме вікно. Назад і вперед працюють через стрілки
перегляду, бічні кнопки миші й Alt+←/→. Ctrl+W закриває перегляд.
Ctrl+F або кнопка пошуку відкриває пошук у відрендерованому документі.
Пошук без урахування регістру показує кількість збігів і підсвічує поточний.
Enter і F3 переходять до наступного збігу, а Shift+Enter і Shift+F3 — до
попереднього, циклічно. Escape спочатку закриває поле пошуку.
Коли локальний Markdown оновлюється на диску, відкритий перегляд
перерендерюється зі збереженням позиції прокрутки.
Вебпосилання HTTP і HTTPS відкриваються в системному браузері.
Binary file not shown.
+6
View File
@@ -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.
+1 -1
View File
@@ -1 +1 @@
bfec959126ea7610b084a53dee2972160ed1fbcc9d71542ec521eab1e113d231 KSwitcher-win-x64.zip
53b30b2610b66b0d40e28b7fcb0b5e7e10c8a2415f38226059c9c239b2f7b58e KSwitcher-win-x64.zip
+73 -73
View File
@@ -1,166 +1,166 @@
{
"schema": 1,
"version": "0.6.103",
"files": [
{
"size": 2361856,
"sha256": "dd3da465620e0d2f97ff829b8dbd2837a703069f21d7003c67829d2c61bf7aca",
"path": "KSwitcher.exe"
"sha256": "176319fec5bfb3714bd31a2fdb8c256297d1d683de50a7f8dda319c40672cd83",
"path": "KSwitcher.exe",
"size": 2361856
},
{
"size": 2359296,
"sha256": "bcb34c5630deeafc3deb2f81f1aea6ea491794e619536721cc38fc5a299bfc7a",
"path": "KSwitcher.Config.exe"
"sha256": "e80a1d11a129f9a00a1698cd6830ac13f335f74f16dd6f407aa2fe6a3ea2bea8",
"path": "KSwitcher.Config.exe",
"size": 2359296
},
{
"size": 3337216,
"sha256": "9f5e1d474c6c1c22410f153e72ce0eeafd9aae0dc8ec39d87316780bd4827667",
"path": "KSwitcher.Screenshot.exe"
"sha256": "e7925cbaaf39645cb8a582f29bd32628c5fbb73be6b60f5f0f870ec9e936d648",
"path": "KSwitcher.Screenshot.exe",
"size": 3337216
},
{
"size": 3746816,
"sha256": "d9a72c4cf23e7763b7dfe08aa0c146d49092023a0a8125f601be7f1f9bbdedac",
"path": "KSwitcher.Files.exe"
"sha256": "ca59044cbb358ff99a6e9badbf5c9bc6b6ca5e41d3673ab063a29e03c297590b",
"path": "KSwitcher.Files.exe",
"size": 3747840
},
{
"size": 194912,
"sha256": "d3fce90bdeecb08596e377dea6a316354dd8949e32ff09b89d51be00c14e21b6",
"path": "WebView2Loader.dll"
"path": "WebView2Loader.dll",
"size": 194912
},
{
"size": 1103,
"sha256": "e256f01188af527e4d06d21d06fbf785ae9c50d4b328bf03cbe0ba7f0aa4228f",
"path": "terminal/addon-fit-LICENSE.txt"
"path": "terminal/addon-fit-LICENSE.txt",
"size": 1103
},
{
"size": 1521,
"sha256": "ba3ea256ce0620a0992a197d6c9baea64823fc93d8da07a9e366ca9943c18527",
"path": "terminal/addon-fit.js"
"path": "terminal/addon-fit.js",
"size": 1521
},
{
"size": 527,
"sha256": "084d97a727b778fb10d31adcd557ee7840a38377ed60e0ef0f3ece93b349b1ef",
"path": "terminal/index.html"
"path": "terminal/index.html",
"size": 527
},
{
"size": 1073,
"sha256": "792c48c5a849a15fdf9e37e8bcf9e6d1dd13b32b46c642a748a0a46a9919d473",
"path": "terminal/markdown-it-LICENSE.txt"
"path": "terminal/markdown-it-LICENSE.txt",
"size": 1073
},
{
"size": 100786,
"sha256": "391f2aa638e75e6c7859d0a5c5650ef0956722a45998f17e05b83bc655778e1e",
"path": "terminal/markdown-it.js"
"path": "terminal/markdown-it.js",
"size": 100786
},
{
"size": 2333,
"sha256": "bb7c4fcda910d31d0837f506968e8e7a3f5d326f3ad4363952b3d682798fde7d",
"path": "terminal/markdown.html"
"sha256": "e5381c35fb254b558c8b869746e2e575c8ed53600611ac90597ed2dd80fa321c",
"path": "terminal/markdown.html",
"size": 3530
},
{
"size": 9434,
"sha256": "3e2e5af2b3a8c0f7223bec102313991032300f08d1ffc6acdaaa19f06b73dcc3",
"path": "terminal/markdown.js"
"sha256": "fe202fa3d3c362aff2ab9028b40bd2aee61240bf9bd4a44af55e45d1a4081cf0",
"path": "terminal/markdown.js",
"size": 14660
},
{
"size": 1089,
"sha256": "ec9fb67dcb25eccc416ed56e1aab819222c805a2a4bfe4cb19e7556bf2ffde80",
"path": "terminal/mermaid-LICENSE.txt"
"path": "terminal/mermaid-LICENSE.txt",
"size": 1089
},
{
"size": 5537838,
"sha256": "336df803d87a38b70a01e736e666c8f7601d2ce42f5e47c8fafe5d721074b9a3",
"path": "terminal/mermaid.js"
"path": "terminal/mermaid.js",
"size": 5537838
},
{
"size": 5033,
"sha256": "0557d251962301940785690a3fc49475dd166bb7d0bd0417dc3279d1f1b3a98a",
"path": "terminal/terminal.js"
"path": "terminal/terminal.js",
"size": 5033
},
{
"size": 1261,
"sha256": "b569f629d00f2626a8100df2a1798210535621e42164dfd426a6fe5aac7b0ccd",
"path": "terminal/xterm-LICENSE.txt"
"path": "terminal/xterm-LICENSE.txt",
"size": 1261
},
{
"size": 7112,
"sha256": "854a7c0fb70e8b1a083c16797ab827299fb18744f5ad34f227b48337e33293c6",
"path": "terminal/xterm.css"
"path": "terminal/xterm.css",
"size": 7112
},
{
"size": 488663,
"sha256": "14903579ff54664cd72f8e8699e6961a6272c21863ec1c3b118cdc8af5d4a972",
"path": "terminal/xterm.js"
"path": "terminal/xterm.js",
"size": 488663
},
{
"size": 4401,
"sha256": "d3c81140cce01c26bf6cbf52aa40e0825e1fa35b9a91d1387170a65d2597082c",
"path": "LICENSE"
"path": "LICENSE",
"size": 4401
},
{
"size": 1075,
"sha256": "c0d068392ea65358b798b8c165103560f06e9e3b38c4ab4e2d8810a7b931af86",
"path": "json-LICENSE.txt"
"path": "json-LICENSE.txt",
"size": 1075
},
{
"size": 883,
"sha256": "185c5a37521316e940ead89cbf0b1ba5862d810c7c966e6c6a14a4a515b23625",
"path": "files-text-license.txt"
"path": "files-text-license.txt",
"size": 883
},
{
"size": 94357,
"sha256": "fca41227e9b38bf061298d69806ea66fb00086ae03aec49665e4f68ed2c3f8e9",
"path": "README.md"
"path": "README.md",
"size": 94357
},
{
"size": 11577,
"sha256": "1233d6a0ed76564dd034f178a9f65db076244a819137f74dc9f2c27df9d3c930",
"path": "LAN-PREVIEW.md"
"path": "LAN-PREVIEW.md",
"size": 11577
},
{
"size": 682867,
"sha256": "5f267c141c3d6837870e1c098f86b89a113ba300343119432644ead88f720c21",
"path": "dictionaries/en.txt"
"path": "dictionaries/en.txt",
"size": 682867
},
{
"size": 20138,
"sha256": "28a9529c7d0bb4dc51f4bf5c116a3d16ef247a052f7591466768ddf563fd1cf5",
"path": "dictionaries/LICENSE-CC-BY-SA-4.0.txt"
"path": "dictionaries/LICENSE-CC-BY-SA-4.0.txt",
"size": 20138
},
{
"size": 2265,
"sha256": "3017bf44d3be9d9dfab21bd6778aa52b7947e61acf9ce2bc86b41d6e949ac311",
"path": "dictionaries/README.md"
"path": "dictionaries/README.md",
"size": 2265
},
{
"size": 1060364,
"sha256": "9ef922c7699569304a428f6aba0fd13a21341c0d0cb9561f37ef83c41577a28b",
"path": "dictionaries/ru.txt"
"path": "dictionaries/ru.txt",
"size": 1060364
},
{
"size": 1280,
"sha256": "98e5b3fe7304e37705c9e5ff48b0b399ccb16e806736d21f09921b99e5f2a408",
"path": "dictionaries/sources.json"
"path": "dictionaries/sources.json",
"size": 1280
},
{
"size": 940799,
"sha256": "d30e990d6ec2983c04f3644a3c61c6c668e8c542323f5931916fdd55b916eebf",
"path": "dictionaries/uk.txt"
"path": "dictionaries/uk.txt",
"size": 940799
},
{
"size": 993,
"sha256": "a34b5161a8315af037e1ec71d816bfc688f7c364141d4ee2347cf0515ef0c82a",
"path": "tools/README.txt"
"path": "tools/README.txt",
"size": 993
},
{
"size": 134656,
"sha256": "6ef5cf64708d62b7fc63c3c793cc99188a513433ff4774cae01dc014f6664376",
"path": "tools/StayHere.exe"
"path": "tools/StayHere.exe",
"size": 134656
},
{
"size": 2796,
"sha256": "ba214e2aca7405e698b3ab21ceb1f41ce088edd996b3e30e4a9d58ff496f9413",
"path": "tools/StayHere-README.md"
"path": "tools/StayHere-README.md",
"size": 2796
}
]
],
"schema": 1,
"version": "0.6.104"
}
+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,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"
+16 -2
View File
@@ -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; }
</style>
<nav aria-label="Document history">
<nav aria-label="Markdown preview">
<button id="back" type="button" title="Back (Alt+Left)" aria-label="Back" disabled>←</button>
<button id="forward" type="button" title="Forward (Alt+Right)" aria-label="Forward" disabled>→</button>
<button id="search-open" type="button" title="Find (Ctrl+F)" aria-label="Find in document" aria-controls="search" aria-expanded="false">⌕</button>
<div id="search" role="search" hidden>
<input id="search-query" type="search" aria-label="Find in document" placeholder="Find in document" autocomplete="off">
<output id="search-status" for="search-query" aria-live="polite"></output>
<button id="search-previous" type="button" title="Previous match (Shift+Enter)" aria-label="Previous match" disabled>↑</button>
<button id="search-next" type="button" title="Next match (Enter)" aria-label="Next match" disabled>↓</button>
<button id="search-close" type="button" title="Close search (Esc)" aria-label="Close search">×</button>
</div>
</nav>
<main></main>
<script src="markdown-it.js"></script>
+122 -1
View File
@@ -4,9 +4,17 @@ const bridge = window.chrome.webview;
const content = document.querySelector('main');
const back = document.querySelector('#back');
const forward = document.querySelector('#forward');
const searchOpen = document.querySelector('#search-open');
const search = document.querySelector('#search');
const searchQuery = document.querySelector('#search-query');
const searchStatus = document.querySelector('#search-status');
const searchPrevious = document.querySelector('#search-previous');
const searchNext = document.querySelector('#search-next');
const markdown = markdownit({ html: true, linkify: true });
let generation = 0;
let images = [];
let matches = [];
let activeMatch = -1;
mermaid.initialize({
startOnLoad: false,
@@ -111,9 +119,108 @@ function navigate(action) {
back.addEventListener('click', () => navigate('back'));
forward.addEventListener('click', () => navigate('forward'));
function updateSearch(reveal = true) {
matches = [];
activeMatch = -1;
const query = searchQuery.value.trim();
if (query) {
const pattern = query.replace(/[.*+?^$(){}|[\]\\]/g, '\\$&').replace(/\s+/g, '\\s+');
const expression = new RegExp(pattern, 'giu');
const blockTags = 'article,aside,blockquote,caption,dd,div,dt,figcaption,footer,h1,h2,h3,h4,h5,h6,header,li,p,pre,section,summary,td,th,text';
const walker = document.createTreeWalker(content, NodeFilter.SHOW_TEXT);
let block = null;
let parts = [];
let text = '';
const searchBlock = () => {
let first = 0;
let last = 0;
for (const match of text.matchAll(expression)) {
const end = match.index + match[0].length;
while (parts[first].end <= match.index) ++first;
last = Math.max(last, first);
while (parts[last].end < end) ++last;
matches.push([parts[first].node, match.index - parts[first].start,
parts[last].node, end - parts[last].start]);
}
parts = [];
text = '';
};
for (let node = walker.nextNode(); node; node = walker.nextNode()) {
const element = node.parentElement;
if (!node.length || element.closest('style,svg title,svg desc,svg defs') ||
!element.checkVisibility({ visibilityProperty: true })) continue;
const nextBlock = element.closest(blockTags);
if (block !== nextBlock) searchBlock();
block = nextBlock;
const start = text.length;
text += node.data;
parts.push({ node, start, end: text.length });
}
searchBlock();
}
showSearchMatch(matches.length ? 0 : -1, reveal);
}
function showSearchMatch(index, reveal) {
activeMatch = index;
searchPrevious.disabled = searchNext.disabled = matches.length < 2;
searchStatus.value = !searchQuery.value.trim() ? '' : index < 0 ? 'No matches' : (index + 1) + ' / ' + matches.length;
CSS.highlights.delete('markdown-search-active');
if (index < 0) return;
const [start, from, end, to] = matches[index];
const range = new Range();
range.setStart(start, from);
range.setEnd(end, to);
CSS.highlights.set('markdown-search-active', new Highlight(range));
if (!reveal) return;
const rect = range.getBoundingClientRect();
const toolbarBottom = search.parentElement.getBoundingClientRect().bottom;
if (rect.top < toolbarBottom || rect.bottom > innerHeight) {
scrollBy(0, rect.top - Math.max(toolbarBottom, innerHeight / 2));
}
const scroller = start.parentElement.closest('pre, table');
if (scroller) {
const bounds = scroller.getBoundingClientRect();
if (rect.left < bounds.left || rect.right > bounds.right) {
scroller.scrollLeft += rect.left - bounds.left;
}
}
}
function openSearch() {
search.hidden = false;
searchOpen.setAttribute('aria-expanded', 'true');
searchQuery.focus({ preventScroll: true });
searchQuery.select();
}
function closeSearch() {
if (search.hidden) return false;
const hadFocus = search.contains(document.activeElement);
search.hidden = true;
searchOpen.setAttribute('aria-expanded', 'false');
searchQuery.value = '';
updateSearch();
if (hadFocus) searchOpen.focus({ preventScroll: true });
return true;
}
function stepSearch(direction) {
if (search.hidden) openSearch();
else if (matches.length) showSearchMatch((activeMatch + direction + matches.length) % matches.length, true);
}
searchOpen.addEventListener('click', openSearch);
document.querySelector('#search-close').addEventListener('click', closeSearch);
searchQuery.addEventListener('input', () => updateSearch());
searchPrevious.addEventListener('click', () => stepSearch(-1));
searchNext.addEventListener('click', () => stepSearch(1));
content.addEventListener('toggle', () => { if (!search.hidden) updateSearch(false); }, true);
async function render({ text, fragment, scroll, title, keepPosition }) {
const current = ++generation;
if (keepPosition) scroll = window.scrollY;
else closeSearch();
document.documentElement.classList.remove('rendered');
document.title = title;
renderContent(text);
@@ -144,6 +251,7 @@ async function render({ text, fragment, scroll, title, keepPosition }) {
}
restorePosition({ fragment, scroll });
document.documentElement.classList.add('rendered');
if (!search.hidden) updateSearch(false);
send('rendered');
}
@@ -163,7 +271,16 @@ document.addEventListener('pointerup', event => {
});
document.addEventListener('keydown', event => {
if (event.ctrlKey && !event.altKey && event.key === 'Tab') {
if (event.isComposing) return;
if (event.ctrlKey && !event.altKey && event.key.toLowerCase() === 'f') {
event.preventDefault();
openSearch();
} else if (event.key === 'F3' || (event.key === 'Enter' && event.target === searchQuery)) {
event.preventDefault();
stepSearch(event.shiftKey ? -1 : 1);
} else if (event.key === 'Escape' && closeSearch()) {
event.preventDefault();
} else if (event.ctrlKey && !event.altKey && event.key === 'Tab') {
event.preventDefault();
send('cycle');
} else if ((event.altKey && ['ArrowLeft', 'ArrowRight'].includes(event.key)) ||
@@ -181,6 +298,7 @@ bridge.addEventListener('message', ({ data }) => {
const message = JSON.parse(data);
if (message.action === 'clear') {
++generation;
closeSearch();
document.documentElement.classList.remove('rendered');
content.replaceChildren();
}
@@ -192,6 +310,9 @@ bridge.addEventListener('message', ({ data }) => {
style.setProperty('--markdown-font', message.font ? CSS.escape(message.font) + ', system-ui, sans-serif' : 'system-ui, sans-serif');
}
if (message.action === 'anchor') restorePosition(message);
if (message.action === 'find') openSearch();
if (message.action === 'find-next') stepSearch(message.previous ? -1 : 1);
if (message.action === 'escape' && !closeSearch()) send('close');
if (message.action === 'back' || message.action === 'forward') navigate(message.action);
if (message.action === 'history') {
back.disabled = !message.back;
+22 -4
View File
@@ -198,7 +198,7 @@ enum Command : UINT
{
save = 1, close, findText, findNext, previousPage, nextPage, firstPage, lastPage, goToPage,
undo, redo, cut, copy, paste, selectAll, lexerAuto, lexerPlain, options, switchMode,
historyBack, historyForward,
historyBack, historyForward, findPrevious, previewEscape,
lexerStart = 1000,
};
@@ -1488,6 +1488,12 @@ void TextWindow::updatePreview()
{
const bool ctrl=(GetKeyState(VK_CONTROL)&0x8000)!=0;
const bool alt=(GetKeyState(VK_MENU)&0x8000)!=0;
if(!alt && ((ctrl && key=='F') || key==VK_F3))
{
const bool shift=(GetKeyState(VK_SHIFT)&0x8000)!=0;
PostMessageW(window,WM_COMMAND,key=='F'?findText:shift?findPrevious:findNext,0);
return true;
}
if(ctrl && !alt && key==VK_TAB)
{
PostMessageW(window,cycleWindow,0,0);
@@ -1499,7 +1505,7 @@ void TextWindow::updatePreview()
return true;
}
if(key!=VK_F6 && key!=VK_ESCAPE && key!=VK_F10 && !(ctrl && key=='W')) return false;
PostMessageW(window,WM_COMMAND,key==VK_F6?switchMode:close,0);
PostMessageW(window,WM_COMMAND,key==VK_F6?switchMode:key==VK_ESCAPE?previewEscape:close,0);
return true;
}))
stopPreview();
@@ -1940,8 +1946,20 @@ void TextWindow::command(UINT id)
reinterpret_cast<LPARAM>(&prompt)) == IDOK) go(prompt.page);
return;
}
case findText: openFind(); return;
case findNext: find((search.flags & FR_DOWN) != 0, search.flags); return;
case findText:
if(previewVisible) preview.post(L"{\"action\":\"find\"}");
else openFind();
return;
case findNext:
case findPrevious:
if(previewVisible)
preview.post(id==findNext?L"{\"action\":\"find-next\"}":L"{\"action\":\"find-next\",\"previous\":true}");
else if(id==findNext) find((search.flags & FR_DOWN) != 0, search.flags);
return;
case previewEscape:
if(previewVisible) preview.post(L"{\"action\":\"escape\"}");
else requestClose();
return;
case undo: if (edit) send(SCI_UNDO); return;
case redo: if (edit) send(SCI_REDO); return;
case cut: if (edit) send(SCI_CUT); return;
+1 -1
View File
@@ -2,7 +2,7 @@
#include "platform.h"
namespace ks
{
inline constexpr wchar_t AppVersion[] = L"0.6.103";
inline constexpr wchar_t AppVersion[] = L"0.6.104";
inline constexpr UINT UpdateMessage = WM_APP + 7;
inline constexpr UINT UpdateCheckIntervalMs = 6 * 60 * 60 * 1000;
inline constexpr UINT UpdateNotificationRetryMs = 5 * 60 * 1000;
+9
View File
@@ -1,6 +1,7 @@
param(
[Parameter(Mandatory)][string]$Executable,
[string]$Screenshot,
[string]$SearchScreenshot,
[string]$Node = 'node',
[string]$LanFixture
)
@@ -128,6 +129,10 @@ try {
- [ ] Pending
- [x] Complete
## Збіг пошуку
Рядок для **збіг пошуку**.
![Relative image](images/tiny%20image.png)
![Missing image](images/missing.png)
<img alt="HTML relative image" src="images/tiny%20image.png">
@@ -187,6 +192,9 @@ const value = 42;
throw 'F3 showed the source text while starting the Markdown preview.'
}
Browser 'render' $Screenshot
Post $window 0x111 3
Browser 'search-menu'
Browser 'search' $SearchScreenshot
Post $main 0x111 133
$options = Wait-For 'the shared Files Options dialog' { Find-Window '#32770' 'KSwitcher Files Options' }
[void][MarkdownUi]::SendText([MarkdownUi]::GetDlgItem($options,270),0x0C,0,'Markdown')
@@ -356,6 +364,7 @@ const value = 42;
$process = Start-Process -FilePath $lanExe -ArgumentList ('"{0}"' -f $original) -PassThru -WindowStyle Normal
$window = Wait-For 'the LAN Markdown viewer' { Find-Window 'KSwitcher.Files.Text' 'Loopback peer' }
Browser 'render'
Browser 'search'
Browser 'edit'
if ((Wait-For 'LAN F6 editor' { Find-Window 'KSwitcher.Files.Text' 'Editor' }) -ne $window) {
throw 'LAN F6 changed windows.'
+69 -3
View File
@@ -39,6 +39,12 @@ async function evaluate(expression) {
return reply.result.value;
}
async function pressKey(key, code, windowsVirtualKeyCode, modifiers = 0) {
const params = { key, code, windowsVirtualKeyCode, modifiers };
await command('Input.dispatchKeyEvent', { type: 'keyDown', ...params });
await command('Input.dispatchKeyEvent', { type: 'keyUp', ...params });
}
const target = await waitFor(async () => {
const response = await fetch('http://127.0.0.1:' + port + '/json/list').catch(() => null);
if (!response?.ok) return;
@@ -113,15 +119,75 @@ try {
.every(entry => entry.name.startsWith(location.origin + '/') || entry.name.startsWith('data:'))`), true);
await waitFor(() => evaluate(`document.querySelector('img[alt="Missing image"]')?.title === 'Image unavailable'`),
'missing image feedback');
assert.deepEqual(await evaluate(`[...document.querySelectorAll('input')].map(box => box.checked)`), [false, true]);
assert.deepEqual(await evaluate(`[...document.querySelectorAll('input')].map(box => { box.click(); return box.checked; })`), [true, false]);
assert.deepEqual(await evaluate(`[...document.querySelectorAll('input')].map(box => { box.click(); return box.checked; })`), [false, true]);
assert.deepEqual(await evaluate(`[...document.querySelectorAll('main input')].map(box => box.checked)`), [false, true]);
assert.deepEqual(await evaluate(`[...document.querySelectorAll('main input')].map(box => { box.click(); return box.checked; })`), [true, false]);
assert.deepEqual(await evaluate(`[...document.querySelectorAll('main input')].map(box => { box.click(); return box.checked; })`), [false, true]);
if (artifact) {
const { cssContentSize } = await command('Page.getLayoutMetrics');
const { data } = await command('Page.captureScreenshot', { captureBeyondViewport: true,
clip: { x:0, y:0, width:cssContentSize.width, height:Math.min(cssContentSize.height, 620), scale:1 } });
await writeFile(artifact, Buffer.from(data, 'base64'));
}
} else if (scenario === 'search-menu' || scenario === 'search') {
const searchFocused = 'document.activeElement === document.getElementById("search-query")';
const searchClosed = 'document.getElementById("search").hidden';
if (scenario === 'search-menu') {
await waitFor(() => evaluate(searchFocused), 'the viewer menu opening rendered Markdown search');
await pressKey('Escape', 'Escape', 27);
await waitFor(() => evaluate(searchClosed), 'Escape closing only the search');
} else {
await pressKey('f', 'KeyF', 70, 2);
await waitFor(() => evaluate(searchFocused), 'Ctrl+F opening search and focusing the search field');
const status = 'document.getElementById("search-status").value';
const active = '[...(CSS.highlights.get("markdown-search-active") || [])][0]?.toString()';
const query = async text => {
await evaluate('document.getElementById("search-query").select()');
await command('Input.insertText', { text });
};
await query('ЗБІГ ПОШУКУ');
assert.equal(await evaluate(status), '1 / 2');
const toolbar = await evaluate(`({
queryWidth: document.getElementById('search-query').getBoundingClientRect().width,
closeRight: document.getElementById('search-close').getBoundingClientRect().right,
viewportWidth: document.documentElement.clientWidth
})`);
assert.ok(toolbar.queryWidth >= 100 && toolbar.closeRight <= toolbar.viewportWidth,
'The search controls must fit the viewer: ' + JSON.stringify(toolbar));
assert.equal(await evaluate(active), 'Збіг пошуку');
await pressKey('Enter', 'Enter', 13);
assert.equal(await evaluate(status), '2 / 2');
assert.equal(await evaluate(active), 'збіг пошуку');
await pressKey('F3', 'F3', 114);
assert.equal(await evaluate(status), '1 / 2');
await pressKey('Enter', 'Enter', 13, 8);
assert.equal(await evaluate(status), '2 / 2');
await pressKey('F3', 'F3', 114, 8);
assert.equal(await evaluate(status), '1 / 2');
await evaluate('document.getElementById("search-previous").click()');
assert.equal(await evaluate(status), '2 / 2');
await evaluate('document.getElementById("search-next").click()');
assert.equal(await evaluate(status), '1 / 2');
if (artifact) {
const { data } = await command('Page.captureScreenshot');
await writeFile(artifact, Buffer.from(data, 'base64'));
}
await query('для збіг пошуку');
assert.equal(await evaluate(status), '1 / 1');
assert.equal(await evaluate(active), 'для збіг пошуку');
await query('RENDER TARGET');
assert.equal(await evaluate(status), '1 / 1');
assert.equal(await evaluate(active), 'Render target');
await query('[no matches]');
assert.equal(await evaluate(status), 'No matches');
assert.equal(await evaluate(active), undefined);
await pressKey('Escape', 'Escape', 27);
assert.equal(await evaluate(searchClosed), true);
assert.equal(await evaluate('document.documentElement.classList.contains("rendered")'), true);
await evaluate('document.getElementById("search-open").click()');
assert.equal(await evaluate(searchFocused), true);
await evaluate('document.getElementById("search-close").click()');
assert.equal(await evaluate(searchClosed), true);
}
} else if (scenario === 'appearance-width' || scenario === 'appearance-full') {
const width = scenario === 'appearance-full' ? 'none' : '1200px';
await waitFor(() => evaluate(`(() => {