Compare commits
10
Commits
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
5ba51ebb00 | ||
|
|
2bc6eb60c9 | ||
|
|
9c1badcb45 | ||
|
|
9dcc20673a | ||
|
|
ec4079b346 | ||
|
|
41cef4d4f3 | ||
|
|
b53b5715ab | ||
|
|
01f44d22b5 | ||
|
|
c78090f7d4 | ||
|
|
0d797c4f35 |
No files matched your search
+1
-1
@@ -1,5 +1,5 @@
|
||||
cmake_minimum_required(VERSION 3.24)
|
||||
project(KSwitcher VERSION 0.6.111 LANGUAGES CXX RC)
|
||||
project(KSwitcher VERSION 0.6.114 LANGUAGES CXX RC)
|
||||
if(NOT WIN32)
|
||||
message(FATAL_ERROR "KSwitcher uses native Windows APIs")
|
||||
endif()
|
||||
|
||||
+7
-1
@@ -50,6 +50,9 @@ Warning і початковий фокус на No.
|
||||
Стрілки вліво й вправо переходять до першого й останнього рядків, коли
|
||||
командний рядок порожній.
|
||||
Клік оновлює підсвічування рядків курсора без перемальовування всієї панелі.
|
||||
При кліку в іншу панель курсор відразу з’являється на вибраному рядку.
|
||||
Попередній рядок цієї панелі оновлюється лише тоді, коли для неактивного
|
||||
курсора він мав інше оформлення.
|
||||
Меню й діалоги тимчасово приймають фокус. Ctrl+V і Shift+Insert вставляють
|
||||
текст із буфера обміну в позицію курсора або замінюють виділення.
|
||||
Enter виконує введену команду, якщо підказку не вибрано. Shift+Enter
|
||||
@@ -58,6 +61,8 @@ Warning і початковий фокус на No.
|
||||
Enter передає порожній рядок у термінал.
|
||||
Якщо фокус у виводі термінала, Enter і Shift+Enter повертають його до
|
||||
командного рядка й виконують відповідну дію за тими самими правилами.
|
||||
Під час запуску термінала область виводу має темне тло, поки WebView2
|
||||
готує сторінку.
|
||||
Промпт і текст команди вирівняні по спільній базовій лінії.
|
||||
- Під час набору локальної команди над полем з’являються підказки PowerShell.
|
||||
Автодоповнення працює з відкритими й прихованими панелями (Ctrl+O).
|
||||
@@ -215,7 +220,8 @@ Warning і початковий фокус на No.
|
||||
За наявності змін перехід у перегляд пропонує Save, Discard або Cancel.
|
||||
Помилка збереження залишає відкритим редактор зі змінами.
|
||||
- Ctrl+Tab циклічно перемикає фокус між Files, редакторами й переглядачами
|
||||
у порядку їх відкриття. Коли відкрито лише Files, активна панель не змінюється.
|
||||
у порядку їх відкриття. Ctrl+Shift+Tab обходить ті самі вікна у зворотному
|
||||
порядку. Коли відкрито лише Files, активна панель не змінюється.
|
||||
- F3 відкриває Markdown як форматований документ із таблицями, блоками коду,
|
||||
інтерактивними чекбоксами списків і діаграмами Mermaid. Відмітки в перегляді
|
||||
діють до повторного рендерингу або виходу з цього режиму. F4 відкриває текст
|
||||
|
||||
@@ -1,5 +1,31 @@
|
||||
# Latest Windows release
|
||||
|
||||
## v0.6.114 — 2026-11-17
|
||||
|
||||
In KSwitcher Files, clicking a row in the inactive pane highlights that row immediately. The previous cursor row in that pane no longer flashes with the active highlight. If it had a custom unfocused cursor color, it returns directly to its normal style.
|
||||
|
||||
**Українською.**
|
||||
|
||||
У KSwitcher Files клік по рядку неактивної панелі одразу підсвічує вибраний рядок. Попередній рядок курсора цієї панелі більше не блимає активним підсвічуванням. Якщо він мав окремий колір неактивного курсора, рядок одразу повертається до звичайного оформлення.
|
||||
|
||||
## v0.6.113 — 2026-11-17
|
||||
|
||||
- KSwitcher Files keeps the terminal output area dark while WebView2 initializes. This fixes the white flash during startup.
|
||||
- The terminal copy regression test checks for a new clipboard write and verifies its contents without first taking clipboard ownership.
|
||||
|
||||
**Українською.**
|
||||
|
||||
- Під час запуску термінала область виводу KSwitcher Files залишається темною, поки WebView2 готує сторінку. Це усуває білий спалах під час відкриття термінала.
|
||||
- Тест копіювання з термінала перевіряє новий запис і його вміст без попереднього захоплення буфера обміну.
|
||||
|
||||
## v0.6.112 — 2026-11-17
|
||||
|
||||
In KSwitcher Files, **Ctrl+Shift+Tab** cycles backward through Files, Editor, and Viewer windows. **Ctrl+Tab** cycles forward. Both shortcuts wrap at the ends of the window list, including in the Markdown preview.
|
||||
|
||||
**Українською.**
|
||||
|
||||
У KSwitcher Files **Ctrl+Shift+Tab** обходить вікна Files, редактора й переглядача у зворотному порядку. **Ctrl+Tab** обходить їх у прямому порядку. Обидві комбінації працюють циклічно, зокрема в перегляді Markdown.
|
||||
|
||||
## v0.6.111 — 2026-11-17
|
||||
|
||||
- KSwitcher Files updates a panel as soon as its background folder scan finishes.
|
||||
|
||||
@@ -1 +1 @@
|
||||
dbc8fd01ed92849bab4516d83e6b51defaca6984d9fa2ff8bccd7cf84760a552 KSwitcher-win-x64.zip
|
||||
aa2c63e1362b22669100eae8bc529fa1f67c41ed822141ad936e8e8661f9c5d1 KSwitcher-win-x64.zip
|
||||
+67
-67
@@ -1,166 +1,166 @@
|
||||
{
|
||||
"version": "0.6.111",
|
||||
"version": "0.6.114",
|
||||
"schema": 1,
|
||||
"files": [
|
||||
{
|
||||
"size": 2479104,
|
||||
"path": "KSwitcher.exe",
|
||||
"sha256": "6b4df34f75dc159b98bb1b442f611faa69d7b0a4c77264c07516394396dcce5d"
|
||||
"sha256": "79b803b43141d62f6a5022fc9dce7fddcbff97e30e71850d309da5cecfa22d26",
|
||||
"path": "KSwitcher.exe"
|
||||
},
|
||||
{
|
||||
"size": 2458112,
|
||||
"path": "KSwitcher.Config.exe",
|
||||
"sha256": "83fc9cde793bb447d750328fafa8305a866bc8de54803c230b31a45a026e50bb"
|
||||
"sha256": "67c1a3071a10b49f9ff13c0ada484c3882e97bd955512c471cddec991ae7da3e",
|
||||
"path": "KSwitcher.Config.exe"
|
||||
},
|
||||
{
|
||||
"size": 3060224,
|
||||
"path": "KSwitcher.Screenshot.exe",
|
||||
"sha256": "5b392de89d073ca5a873133fa2fc35fde44332126ef6e1817a1a87ceb90bb7ae"
|
||||
"sha256": "b1607b2192b591cd4d7f553a9a69d015f68a1d69882f1cdccf312c93574186aa",
|
||||
"path": "KSwitcher.Screenshot.exe"
|
||||
},
|
||||
{
|
||||
"size": 4214272,
|
||||
"path": "KSwitcher.Files.exe",
|
||||
"sha256": "f6ea287774d81d6c28e4dbba87d201d831f958f4cfe9fbd002b7d6a54e287b3c"
|
||||
"size": 4217344,
|
||||
"sha256": "20c4488abc0ae2e21441a5934ae860f83ab66561bbe4066079706046fa1b0fa2",
|
||||
"path": "KSwitcher.Files.exe"
|
||||
},
|
||||
{
|
||||
"size": 194912,
|
||||
"path": "WebView2Loader.dll",
|
||||
"sha256": "d3fce90bdeecb08596e377dea6a316354dd8949e32ff09b89d51be00c14e21b6"
|
||||
"sha256": "d3fce90bdeecb08596e377dea6a316354dd8949e32ff09b89d51be00c14e21b6",
|
||||
"path": "WebView2Loader.dll"
|
||||
},
|
||||
{
|
||||
"size": 1103,
|
||||
"path": "terminal/addon-fit-LICENSE.txt",
|
||||
"sha256": "e256f01188af527e4d06d21d06fbf785ae9c50d4b328bf03cbe0ba7f0aa4228f"
|
||||
"sha256": "e256f01188af527e4d06d21d06fbf785ae9c50d4b328bf03cbe0ba7f0aa4228f",
|
||||
"path": "terminal/addon-fit-LICENSE.txt"
|
||||
},
|
||||
{
|
||||
"size": 1521,
|
||||
"path": "terminal/addon-fit.js",
|
||||
"sha256": "ba3ea256ce0620a0992a197d6c9baea64823fc93d8da07a9e366ca9943c18527"
|
||||
"sha256": "ba3ea256ce0620a0992a197d6c9baea64823fc93d8da07a9e366ca9943c18527",
|
||||
"path": "terminal/addon-fit.js"
|
||||
},
|
||||
{
|
||||
"size": 527,
|
||||
"path": "terminal/index.html",
|
||||
"sha256": "084d97a727b778fb10d31adcd557ee7840a38377ed60e0ef0f3ece93b349b1ef"
|
||||
"sha256": "084d97a727b778fb10d31adcd557ee7840a38377ed60e0ef0f3ece93b349b1ef",
|
||||
"path": "terminal/index.html"
|
||||
},
|
||||
{
|
||||
"size": 1073,
|
||||
"path": "terminal/markdown-it-LICENSE.txt",
|
||||
"sha256": "792c48c5a849a15fdf9e37e8bcf9e6d1dd13b32b46c642a748a0a46a9919d473"
|
||||
"sha256": "792c48c5a849a15fdf9e37e8bcf9e6d1dd13b32b46c642a748a0a46a9919d473",
|
||||
"path": "terminal/markdown-it-LICENSE.txt"
|
||||
},
|
||||
{
|
||||
"size": 100786,
|
||||
"path": "terminal/markdown-it.js",
|
||||
"sha256": "391f2aa638e75e6c7859d0a5c5650ef0956722a45998f17e05b83bc655778e1e"
|
||||
"sha256": "391f2aa638e75e6c7859d0a5c5650ef0956722a45998f17e05b83bc655778e1e",
|
||||
"path": "terminal/markdown-it.js"
|
||||
},
|
||||
{
|
||||
"size": 3530,
|
||||
"path": "terminal/markdown.html",
|
||||
"sha256": "e5381c35fb254b558c8b869746e2e575c8ed53600611ac90597ed2dd80fa321c"
|
||||
"sha256": "e5381c35fb254b558c8b869746e2e575c8ed53600611ac90597ed2dd80fa321c",
|
||||
"path": "terminal/markdown.html"
|
||||
},
|
||||
{
|
||||
"size": 14987,
|
||||
"path": "terminal/markdown.js",
|
||||
"sha256": "5d1e824df1c3570877e985de0cfaae3f2984ceef7fe23bf4c5ade3c890a93223"
|
||||
"size": 15014,
|
||||
"sha256": "55c905afaf074e3253267a7c48a5ebca14edd7f15449fd85c0a884c34da22763",
|
||||
"path": "terminal/markdown.js"
|
||||
},
|
||||
{
|
||||
"size": 1089,
|
||||
"path": "terminal/mermaid-LICENSE.txt",
|
||||
"sha256": "ec9fb67dcb25eccc416ed56e1aab819222c805a2a4bfe4cb19e7556bf2ffde80"
|
||||
"sha256": "ec9fb67dcb25eccc416ed56e1aab819222c805a2a4bfe4cb19e7556bf2ffde80",
|
||||
"path": "terminal/mermaid-LICENSE.txt"
|
||||
},
|
||||
{
|
||||
"size": 5537838,
|
||||
"path": "terminal/mermaid.js",
|
||||
"sha256": "336df803d87a38b70a01e736e666c8f7601d2ce42f5e47c8fafe5d721074b9a3"
|
||||
"sha256": "336df803d87a38b70a01e736e666c8f7601d2ce42f5e47c8fafe5d721074b9a3",
|
||||
"path": "terminal/mermaid.js"
|
||||
},
|
||||
{
|
||||
"size": 5033,
|
||||
"path": "terminal/terminal.js",
|
||||
"sha256": "0557d251962301940785690a3fc49475dd166bb7d0bd0417dc3279d1f1b3a98a"
|
||||
"sha256": "0557d251962301940785690a3fc49475dd166bb7d0bd0417dc3279d1f1b3a98a",
|
||||
"path": "terminal/terminal.js"
|
||||
},
|
||||
{
|
||||
"size": 1261,
|
||||
"path": "terminal/xterm-LICENSE.txt",
|
||||
"sha256": "b569f629d00f2626a8100df2a1798210535621e42164dfd426a6fe5aac7b0ccd"
|
||||
"sha256": "b569f629d00f2626a8100df2a1798210535621e42164dfd426a6fe5aac7b0ccd",
|
||||
"path": "terminal/xterm-LICENSE.txt"
|
||||
},
|
||||
{
|
||||
"size": 7112,
|
||||
"path": "terminal/xterm.css",
|
||||
"sha256": "854a7c0fb70e8b1a083c16797ab827299fb18744f5ad34f227b48337e33293c6"
|
||||
"sha256": "854a7c0fb70e8b1a083c16797ab827299fb18744f5ad34f227b48337e33293c6",
|
||||
"path": "terminal/xterm.css"
|
||||
},
|
||||
{
|
||||
"size": 488663,
|
||||
"path": "terminal/xterm.js",
|
||||
"sha256": "14903579ff54664cd72f8e8699e6961a6272c21863ec1c3b118cdc8af5d4a972"
|
||||
"sha256": "14903579ff54664cd72f8e8699e6961a6272c21863ec1c3b118cdc8af5d4a972",
|
||||
"path": "terminal/xterm.js"
|
||||
},
|
||||
{
|
||||
"size": 4401,
|
||||
"path": "LICENSE",
|
||||
"sha256": "d3c81140cce01c26bf6cbf52aa40e0825e1fa35b9a91d1387170a65d2597082c"
|
||||
"sha256": "d3c81140cce01c26bf6cbf52aa40e0825e1fa35b9a91d1387170a65d2597082c",
|
||||
"path": "LICENSE"
|
||||
},
|
||||
{
|
||||
"size": 1096,
|
||||
"path": "json-LICENSE.txt",
|
||||
"sha256": "61e08da79c44061654015ce6b0c4061c23ee1dd18237fbf09e9bfda3c0ea2831"
|
||||
"sha256": "61e08da79c44061654015ce6b0c4061c23ee1dd18237fbf09e9bfda3c0ea2831",
|
||||
"path": "json-LICENSE.txt"
|
||||
},
|
||||
{
|
||||
"size": 883,
|
||||
"path": "files-text-license.txt",
|
||||
"sha256": "185c5a37521316e940ead89cbf0b1ba5862d810c7c966e6c6a14a4a515b23625"
|
||||
"sha256": "185c5a37521316e940ead89cbf0b1ba5862d810c7c966e6c6a14a4a515b23625",
|
||||
"path": "files-text-license.txt"
|
||||
},
|
||||
{
|
||||
"size": 95289,
|
||||
"path": "README.md",
|
||||
"sha256": "fcbd14b6190dc2a3575a4bc4be7229540c647022cb038d33ec4ac22176c67a9e"
|
||||
"sha256": "fcbd14b6190dc2a3575a4bc4be7229540c647022cb038d33ec4ac22176c67a9e",
|
||||
"path": "README.md"
|
||||
},
|
||||
{
|
||||
"size": 11577,
|
||||
"path": "LAN-PREVIEW.md",
|
||||
"sha256": "1233d6a0ed76564dd034f178a9f65db076244a819137f74dc9f2c27df9d3c930"
|
||||
"sha256": "1233d6a0ed76564dd034f178a9f65db076244a819137f74dc9f2c27df9d3c930",
|
||||
"path": "LAN-PREVIEW.md"
|
||||
},
|
||||
{
|
||||
"size": 732485,
|
||||
"path": "dictionaries/en.txt",
|
||||
"sha256": "d0c022b27b9fbc2ff7b6b8bec723cc1adc4eef517202f9ff77eed5d8bea3acb9"
|
||||
"sha256": "d0c022b27b9fbc2ff7b6b8bec723cc1adc4eef517202f9ff77eed5d8bea3acb9",
|
||||
"path": "dictionaries/en.txt"
|
||||
},
|
||||
{
|
||||
"size": 20566,
|
||||
"path": "dictionaries/LICENSE-CC-BY-SA-4.0.txt",
|
||||
"sha256": "0bdfb0201d1803634f268cdff0993b8349d2c70e956a06dbb667c8dd65254ec5"
|
||||
"sha256": "0bdfb0201d1803634f268cdff0993b8349d2c70e956a06dbb667c8dd65254ec5",
|
||||
"path": "dictionaries/LICENSE-CC-BY-SA-4.0.txt"
|
||||
},
|
||||
{
|
||||
"size": 2265,
|
||||
"path": "dictionaries/README.md",
|
||||
"sha256": "3017bf44d3be9d9dfab21bd6778aa52b7947e61acf9ce2bc86b41d6e949ac311"
|
||||
"sha256": "3017bf44d3be9d9dfab21bd6778aa52b7947e61acf9ce2bc86b41d6e949ac311",
|
||||
"path": "dictionaries/README.md"
|
||||
},
|
||||
{
|
||||
"size": 1109134,
|
||||
"path": "dictionaries/ru.txt",
|
||||
"sha256": "80e6b6a27815973535f7facb636c597eb845dfee45cfabfc4e9b3341b9332849"
|
||||
"sha256": "80e6b6a27815973535f7facb636c597eb845dfee45cfabfc4e9b3341b9332849",
|
||||
"path": "dictionaries/ru.txt"
|
||||
},
|
||||
{
|
||||
"size": 1280,
|
||||
"path": "dictionaries/sources.json",
|
||||
"sha256": "98e5b3fe7304e37705c9e5ff48b0b399ccb16e806736d21f09921b99e5f2a408"
|
||||
"sha256": "98e5b3fe7304e37705c9e5ff48b0b399ccb16e806736d21f09921b99e5f2a408",
|
||||
"path": "dictionaries/sources.json"
|
||||
},
|
||||
{
|
||||
"size": 940799,
|
||||
"path": "dictionaries/uk.txt",
|
||||
"sha256": "d30e990d6ec2983c04f3644a3c61c6c668e8c542323f5931916fdd55b916eebf"
|
||||
"sha256": "d30e990d6ec2983c04f3644a3c61c6c668e8c542323f5931916fdd55b916eebf",
|
||||
"path": "dictionaries/uk.txt"
|
||||
},
|
||||
{
|
||||
"size": 993,
|
||||
"path": "tools/README.txt",
|
||||
"sha256": "a34b5161a8315af037e1ec71d816bfc688f7c364141d4ee2347cf0515ef0c82a"
|
||||
"sha256": "a34b5161a8315af037e1ec71d816bfc688f7c364141d4ee2347cf0515ef0c82a",
|
||||
"path": "tools/README.txt"
|
||||
},
|
||||
{
|
||||
"size": 133120,
|
||||
"path": "tools/StayHere.exe",
|
||||
"sha256": "a2e34f817ecdc88b870d5e93418d8364a5fe8af81496b364e10b0f6587492e0d"
|
||||
"sha256": "9a66349b7184639013843206c113e16a2d0e9cd88686a1a259e5f8ed9a9e9d89",
|
||||
"path": "tools/StayHere.exe"
|
||||
},
|
||||
{
|
||||
"size": 2796,
|
||||
"path": "tools/StayHere-README.md",
|
||||
"sha256": "ba214e2aca7405e698b3ab21ceb1f41ce088edd996b3e30e4a9d58ff496f9413"
|
||||
"sha256": "ba214e2aca7405e698b3ab21ceb1f41ce088edd996b3e30e4a9d58ff496f9413",
|
||||
"path": "tools/StayHere-README.md"
|
||||
}
|
||||
]
|
||||
}
|
||||
+3
-3
@@ -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,111,0
|
||||
PRODUCTVERSION 0,6,111,0
|
||||
FILEVERSION 0,6,114,0
|
||||
PRODUCTVERSION 0,6,114,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.111"
|
||||
VALUE "FileVersion", "0.6.114"
|
||||
END
|
||||
END
|
||||
BLOCK "VarFileInfo"
|
||||
|
||||
@@ -282,7 +282,7 @@ document.addEventListener('keydown', event => {
|
||||
event.preventDefault();
|
||||
} else if (event.ctrlKey && !event.altKey && event.key === 'Tab') {
|
||||
event.preventDefault();
|
||||
send('cycle');
|
||||
send('cycle', {reverse: event.shiftKey});
|
||||
} else if ((event.altKey && ['ArrowLeft', 'ArrowRight'].includes(event.key)) ||
|
||||
['BrowserBack', 'BrowserForward'].includes(event.key)) {
|
||||
event.preventDefault();
|
||||
|
||||
+43
-29
@@ -528,6 +528,19 @@ void savePreference(const wchar_t *name, DWORD value)
|
||||
}
|
||||
|
||||
#include "files_styles.inl"
|
||||
|
||||
FileRowStyle panelRowStyle(const Panel &panel,size_t row,bool cursor,bool activePanel)
|
||||
{
|
||||
const bool focused=cursor && activePanel;
|
||||
const auto foreground=colors[Text],background=colors[focused?PanelCursor:PanelBlue];
|
||||
if(row>=panel.rows.size() || panel.sizes[row]==L"Up") return {foreground,background};
|
||||
const bool marked=panel.marked[row];
|
||||
const bool transferred=transferHighlightPhase%2==0 && panel.transferResults.contains(panel.rows[row]);
|
||||
const auto state=marked?FileRowState::Marked:!cursor?FileRowState::Normal:
|
||||
focused?FileRowState::Focused:FileRowState::Unfocused;
|
||||
return resolveFileStyle(panel.rows[row].extension().native(),panel.sizes[row]!=L"Folder",panel.dimmed[row],
|
||||
focused || marked || transferred,foreground,background,fileStyles,state,transferred);
|
||||
}
|
||||
void setStatus(const std::wstring &message);
|
||||
void refreshCommandHistory();
|
||||
#include "files_command_history.inl"
|
||||
@@ -5238,9 +5251,12 @@ LRESULT CALLBACK panelKeys(HWND window, UINT message, WPARAM wp, LPARAM lp, UINT
|
||||
{
|
||||
if(message==WM_LBUTTONDOWN) clearTerminalSelection();
|
||||
auto &panel=panels[index];
|
||||
activatePanel(static_cast<int>(index));
|
||||
const auto count=SendMessageW(window,LB_GETCOUNT,0,0);
|
||||
if(!count || count==LB_ERR) return 0;
|
||||
if(count<=0)
|
||||
{
|
||||
activatePanel(index);
|
||||
return 0;
|
||||
}
|
||||
const auto hit=SendMessageW(window,LB_ITEMFROMPOINT,0,lp);
|
||||
const auto row=static_cast<LRESULT>(LOWORD(hit));
|
||||
const POINT point{GET_X_LPARAM(lp),GET_Y_LPARAM(lp)};
|
||||
@@ -5250,13 +5266,26 @@ LRESULT CALLBACK panelKeys(HWND window, UINT message, WPARAM wp, LPARAM lp, UINT
|
||||
PtInRect(&bounds,point);
|
||||
const auto previous=SendMessageW(window,LB_GETCURSEL,0,0);
|
||||
const auto target=rowHit?row:point.y>=0 && message==WM_LBUTTONDOWN?count-1:previous;
|
||||
if(target!=previous)
|
||||
if(target!=previous && index!=active)
|
||||
{
|
||||
const auto top=SendMessageW(window,LB_GETTOPINDEX,0,0);
|
||||
// The native list can repaint during selection. Activate it only after moving the cursor.
|
||||
const bool visible=IsWindowVisible(window);
|
||||
if(visible) SendMessageW(window,WM_SETREDRAW,FALSE,0);
|
||||
SendMessageW(window,LB_SETCURSEL,target,0);
|
||||
if(visible) SendMessageW(window,WM_SETREDRAW,TRUE,0);
|
||||
if(top!=SendMessageW(window,LB_GETTOPINDEX,0,0))
|
||||
InvalidateRect(window,nullptr,FALSE);
|
||||
else if(panelRowStyle(panel,previous,true,false)!=panelRowStyle(panel,previous,false,false))
|
||||
invalidatePanelRow(window,previous);
|
||||
}
|
||||
else if(target!=previous)
|
||||
{
|
||||
// The list box can draw synchronously before committing its new selection.
|
||||
SendMessageW(window,LB_SETCURSEL,target,0);
|
||||
invalidatePanelCursorChange(window,previous);
|
||||
}
|
||||
showFileDetails(panel);
|
||||
activatePanel(index);
|
||||
if(message==WM_LBUTTONDOWN) SetCapture(window);
|
||||
if(message==WM_LBUTTONDBLCLK && rowHit) enter(panel);
|
||||
return 0;
|
||||
@@ -5748,7 +5777,7 @@ LRESULT CALLBACK filesWindow(HWND window, UINT message, WPARAM wp, LPARAM lp)
|
||||
if(!completionList || !completionFrame) return -1;
|
||||
SetWindowSubclass(completionList,completionClick,1,0);
|
||||
installScrollBar(completionList,completionFrame);
|
||||
terminalBackground=CreateSolidBrush(RGB(24,24,24));
|
||||
terminalBackground=CreateSolidBrush(terminalSurface);
|
||||
if(!terminalInput || !terminalOutput || !terminalPrompt || !terminalBackground) return -1;
|
||||
for(const auto control:{terminalInput,terminalOutput,terminalPrompt})
|
||||
SendMessageW(control,WM_SETFONT,reinterpret_cast<WPARAM>(mono),FALSE);
|
||||
@@ -5899,7 +5928,7 @@ LRESULT CALLBACK filesWindow(HWND window, UINT message, WPARAM wp, LPARAM lp)
|
||||
reinterpret_cast<HWND>(lp)==terminalPrompt)
|
||||
{
|
||||
SetTextColor(dc,RGB(232,232,232));
|
||||
SetBkColor(dc,RGB(24,24,24));
|
||||
SetBkColor(dc,terminalSurface);
|
||||
return reinterpret_cast<LRESULT>(terminalBackground);
|
||||
}
|
||||
SetTextColor(dc,colors[Frame]);
|
||||
@@ -6069,34 +6098,19 @@ LRESULT CALLBACK filesWindow(HWND window, UINT message, WPARAM wp, LPARAM lp)
|
||||
background=Selection;
|
||||
const bool panelRow=item.CtlID==102 || item.CtlID==103;
|
||||
const bool activePanelRow=panelRow && item.hwndItem==panels[active].list;
|
||||
if(panelRow)
|
||||
{
|
||||
const auto cursor=SendMessageW(item.hwndItem,LB_GETCURSEL,0,0);
|
||||
if(activePanelRow && cursor!=LB_ERR &&
|
||||
static_cast<UINT>(cursor)==item.itemID) background=PanelCursor;
|
||||
traceTerminal("panel-draw",item.CtlID-102,item.itemID,background==PanelCursor);
|
||||
}
|
||||
else if(item.itemState&(ODS_SELECTED|ODS_FOCUS))
|
||||
if(!panelRow && (item.itemState&(ODS_SELECTED|ODS_FOCUS)))
|
||||
background=Selection;
|
||||
COLORREF rowBackground=colors[background];
|
||||
HFONT rowFont{};
|
||||
if(panelRow)
|
||||
{
|
||||
const auto &panel=panels[item.CtlID-102];
|
||||
if(item.itemID<panel.rows.size() && panel.sizes[item.itemID]!=L"Up")
|
||||
{
|
||||
const bool marked=panel.marked[item.itemID];
|
||||
const bool transferred=transferHighlightPhase%2==0 && panel.transferResults.contains(panel.rows[item.itemID]);
|
||||
const bool cursor=SendMessageW(panel.list,LB_GETCURSEL,0,0)==item.itemID;
|
||||
const auto state=marked?FileRowState::Marked:!cursor?FileRowState::Normal:
|
||||
activePanelRow?FileRowState::Focused:FileRowState::Unfocused;
|
||||
const auto resolved=resolveFileStyle(panel.rows[item.itemID].extension().native(),
|
||||
panel.sizes[item.itemID]!=L"Folder",panel.dimmed[item.itemID],
|
||||
background==PanelCursor || marked || transferred,foreground,rowBackground,fileStyles,state,transferred);
|
||||
foreground=resolved.foreground;
|
||||
rowBackground=resolved.background;
|
||||
rowFont=fileStyleFonts[resolved.decorations];
|
||||
}
|
||||
const bool cursor=item.itemID!=UINT(-1) && SendMessageW(panel.list,LB_GETCURSEL,0,0)==item.itemID;
|
||||
traceTerminal("panel-draw",item.CtlID-102,item.itemID,activePanelRow && cursor);
|
||||
const auto resolved=panelRowStyle(panel,item.itemID,cursor,activePanelRow);
|
||||
foreground=resolved.foreground;
|
||||
rowBackground=resolved.background;
|
||||
rowFont=fileStyleFonts[resolved.decorations];
|
||||
}
|
||||
auto shortcut=text.find(L'\t');
|
||||
if(item.hwndItem==picker && commandPicker && item.itemID<commandAccessPositions.size())
|
||||
@@ -6374,7 +6388,7 @@ int WINAPI wWinMain(HINSTANCE instance, HINSTANCE, PWSTR, int show)
|
||||
if(GetMessageW(&message,nullptr,0,0)<=0) break;
|
||||
if(message.message==WM_KEYDOWN && message.wParam==VK_TAB &&
|
||||
(GetKeyState(VK_CONTROL)&0x8000) && !(GetKeyState(VK_MENU)&0x8000) &&
|
||||
ks::files::cycleTextWindows(GetAncestor(message.hwnd,GA_ROOT)))
|
||||
ks::files::cycleTextWindows(GetAncestor(message.hwnd,GA_ROOT),(GetKeyState(VK_SHIFT)&0x8000)!=0))
|
||||
continue;
|
||||
if(!IsWindow(window) || (message.hwnd && GetAncestor(message.hwnd,GA_ROOTOWNER)!=window))
|
||||
{
|
||||
|
||||
@@ -128,6 +128,7 @@ struct FileRowStyle
|
||||
{
|
||||
COLORREF foreground,background;
|
||||
unsigned decorations{};
|
||||
bool operator==(const FileRowStyle &) const = default;
|
||||
};
|
||||
FileRowStyle resolveFileStyle(std::wstring_view extension,bool file,bool dimmed,bool protectedRow,
|
||||
COLORREF foreground,COLORREF background,const std::vector<FileStyle> &styles=fileStyles,
|
||||
|
||||
@@ -3,6 +3,9 @@
|
||||
|
||||
#ifdef __MINGW32__
|
||||
__CRT_UUID_DECL(ICoreWebView2_3, 0xA0D6DF20, 0x3B92, 0x416D, 0xAA, 0x0C, 0x43, 0x7A, 0x9C, 0x72, 0x78, 0x57)
|
||||
__CRT_UUID_DECL(ICoreWebView2Controller2, 0xc979903e, 0xd4ca, 0x4228, 0x92, 0xeb, 0x47, 0xee, 0x3f, 0xa9, 0x6e, 0xab)
|
||||
__CRT_UUID_DECL(ICoreWebView2ControllerOptions3, 0xb32b191a, 0x8998, 0x57ca, 0xb7, 0xcb, 0xe0, 0x46, 0x17, 0xe4, 0xce, 0x4a)
|
||||
__CRT_UUID_DECL(ICoreWebView2Environment10, 0xee0eb9df, 0x6f12, 0x46ce, 0xb5, 0x3f, 0x3f, 0x47, 0xb9, 0xc9, 0x28, 0xe0)
|
||||
__CRT_UUID_DECL(ICoreWebView2CreateCoreWebView2EnvironmentCompletedHandler, 0x4e8a3389, 0xc9d8, 0x4bd2, 0xb6, 0xb5, 0x12, 0x4f, 0xee, 0x6c, 0xc1, 0x4d)
|
||||
__CRT_UUID_DECL(ICoreWebView2CreateCoreWebView2ControllerCompletedHandler, 0x6c4819f3, 0xc9b7, 0x4260, 0x81, 0x27, 0xc9, 0xf5, 0xbd, 0xe7, 0xf6, 0x8c)
|
||||
__CRT_UUID_DECL(ICoreWebView2WebMessageReceivedEventHandler, 0x57213f19, 0x00e6, 0x49fa, 0x8e, 0x07, 0x89, 0x8e, 0xa0, 0x1e, 0xcb, 0xd2)
|
||||
@@ -16,6 +19,8 @@ __CRT_UUID_DECL(ICoreWebView2AcceleratorKeyPressedEventHandler, 0xb29c7e28, 0xfa
|
||||
#include <memory>
|
||||
#include <utility>
|
||||
|
||||
inline constexpr COLORREF terminalSurface=RGB(24,24,24);
|
||||
|
||||
template<class Interface, class... Args>
|
||||
class TerminalCallback final : public Interface
|
||||
{
|
||||
@@ -56,6 +61,7 @@ class FilesTerminalView
|
||||
RECT bounds{};
|
||||
bool ready{};
|
||||
bool visible{};
|
||||
bool waitForReady{};
|
||||
public:
|
||||
~FilesTerminalView() { close(); }
|
||||
void focus()
|
||||
@@ -94,9 +100,10 @@ public:
|
||||
RECT current{};
|
||||
if(FAILED(controller->get_Bounds(¤t)) || !EqualRect(¤t,&bounds))
|
||||
controller->put_Bounds(bounds);
|
||||
const bool showController=show && (!waitForReady || ready);
|
||||
BOOL currentVisibility{};
|
||||
if(FAILED(controller->get_IsVisible(¤tVisibility)) || !!currentVisibility!=show)
|
||||
controller->put_IsVisible(show);
|
||||
if(FAILED(controller->get_IsVisible(¤tVisibility)) || !!currentVisibility!=showController)
|
||||
controller->put_IsVisible(showController);
|
||||
}
|
||||
void close()
|
||||
{
|
||||
@@ -140,6 +147,9 @@ public:
|
||||
const auto uri=std::wstring(L"https://")+origin+(markdown?L"/markdown.html":L"/index.html");
|
||||
const auto assets=folder/L"terminal";
|
||||
if(markdown && !std::filesystem::exists(assets/L"markdown.html")) return false;
|
||||
waitForReady=!markdown;
|
||||
constexpr COREWEBVIEW2_COLOR background{
|
||||
255,GetRValue(terminalSurface),GetGValue(terminalSurface),GetBValue(terminalSurface)};
|
||||
lifetime=std::make_shared<int>(0);
|
||||
const std::weak_ptr<int> alive=lifetime;
|
||||
auto environment=terminalCallback<ICoreWebView2CreateCoreWebView2EnvironmentCompletedHandler,
|
||||
@@ -153,6 +163,12 @@ public:
|
||||
if(alive.expired()) return S_OK;
|
||||
if(FAILED(result) || !view) { failed(); return S_OK; }
|
||||
controller=view;
|
||||
if(!markdown)
|
||||
{
|
||||
view->put_IsVisible(FALSE);
|
||||
Microsoft::WRL::ComPtr<ICoreWebView2Controller2> colors;
|
||||
if(SUCCEEDED(controller.As(&colors))) colors->put_DefaultBackgroundColor(background);
|
||||
}
|
||||
view->get_CoreWebView2(&web);
|
||||
Microsoft::WRL::ComPtr<ICoreWebView2_3> mapped;
|
||||
if(!web || FAILED(web.As(&mapped)) || FAILED(mapped->SetVirtualHostNameToFolderMapping(
|
||||
@@ -207,7 +223,11 @@ public:
|
||||
uri==source &&
|
||||
SUCCEEDED(args->TryGetWebMessageAsString(&value)))
|
||||
{
|
||||
if(wcscmp(value,L"ready")==0) ready=true;
|
||||
if(!ready && wcscmp(value,L"ready")==0)
|
||||
{
|
||||
ready=true;
|
||||
if(waitForReady) layout(bounds,visible);
|
||||
}
|
||||
if(ready) receive(value);
|
||||
}
|
||||
CoTaskMemFree(value);
|
||||
@@ -222,6 +242,18 @@ public:
|
||||
layout(bounds,visible);
|
||||
return S_OK;
|
||||
});
|
||||
if(!markdown)
|
||||
{
|
||||
Microsoft::WRL::ComPtr<ICoreWebView2Environment10> configurable;
|
||||
Microsoft::WRL::ComPtr<ICoreWebView2ControllerOptions> options;
|
||||
Microsoft::WRL::ComPtr<ICoreWebView2ControllerOptions3> colors;
|
||||
if(SUCCEEDED(env->QueryInterface(IID_PPV_ARGS(&configurable))) &&
|
||||
SUCCEEDED(configurable->CreateCoreWebView2ControllerOptions(&options)) &&
|
||||
SUCCEEDED(options.As(&colors)) &&
|
||||
SUCCEEDED(colors->put_DefaultBackgroundColor(background)) &&
|
||||
SUCCEEDED(configurable->CreateCoreWebView2ControllerWithOptions(host,options.Get(),completed.Get())))
|
||||
return S_OK;
|
||||
}
|
||||
if(FAILED(env->CreateCoreWebView2Controller(host,completed.Get()))) failed();
|
||||
return S_OK;
|
||||
});
|
||||
|
||||
@@ -1547,7 +1547,7 @@ void TextWindow::updatePreview()
|
||||
}
|
||||
if(ctrl && !alt && key==VK_TAB)
|
||||
{
|
||||
PostMessageW(window,cycleWindow,0,0);
|
||||
PostMessageW(window,cycleWindow,(GetKeyState(VK_SHIFT)&0x8000)!=0,0);
|
||||
return true;
|
||||
}
|
||||
if(key==VK_BROWSER_BACK || key==VK_BROWSER_FORWARD || (alt && (key==VK_LEFT || key==VK_RIGHT)))
|
||||
@@ -1679,7 +1679,7 @@ void TextWindow::previewMessage(const std::wstring &value)
|
||||
const auto action=message.at("action").get<std::string>();
|
||||
if(action=="cycle")
|
||||
{
|
||||
PostMessageW(window,cycleWindow,0,0);
|
||||
PostMessageW(window,cycleWindow,message.value("reverse",false),0);
|
||||
return;
|
||||
}
|
||||
if(action=="failed")
|
||||
@@ -2213,7 +2213,7 @@ LRESULT CALLBACK TextWindow::procedure(HWND window, UINT message, WPARAM wparam,
|
||||
return 0;
|
||||
}
|
||||
case WM_SETFOCUS: self->focusContent(); return 0;
|
||||
case cycleWindow: cycleTextWindows(window); return 0;
|
||||
case cycleWindow: cycleTextWindows(window,wparam!=0); return 0;
|
||||
case WM_KEYDOWN:
|
||||
if(self->previewWanted && !self->previewVisible)
|
||||
{
|
||||
@@ -2412,7 +2412,7 @@ void textWindowOwnerClosed()
|
||||
if(textWindows.empty()) PostQuitMessage(0);
|
||||
}
|
||||
|
||||
bool cycleTextWindows(HWND current)
|
||||
bool cycleTextWindows(HWND current,bool reverse)
|
||||
{
|
||||
if(!current || (current!=filesOwner && !textWindows.contains(current))) return false;
|
||||
std::vector<HWND> windows;
|
||||
@@ -2422,11 +2422,12 @@ bool cycleTextWindows(HWND current)
|
||||
if(windows.size()<2) return false;
|
||||
const auto from=std::find(windows.begin(),windows.end(),current);
|
||||
if(from==windows.end()) return false;
|
||||
auto to=std::next(from);
|
||||
if(to==windows.end()) to=windows.begin();
|
||||
if(IsIconic(*to)) ShowWindow(*to,SW_RESTORE);
|
||||
SetForegroundWindow(*to);
|
||||
if(*to!=filesOwner) SendMessageW(*to,WM_SETFOCUS,0,0);
|
||||
const auto index=static_cast<size_t>(from-windows.begin());
|
||||
const auto step=reverse?windows.size()-1:1;
|
||||
const auto target=windows[(index+step)%windows.size()];
|
||||
if(IsIconic(target)) ShowWindow(target,SW_RESTORE);
|
||||
SetForegroundWindow(target);
|
||||
if(target!=filesOwner) SendMessageW(target,WM_SETFOCUS,0,0);
|
||||
return true;
|
||||
}
|
||||
|
||||
|
||||
@@ -54,5 +54,5 @@ struct TextDialogs
|
||||
void openTextWindow(HWND owner,const std::filesystem::path &path,bool edit,TextDialogs dialogs,
|
||||
const lan::FilesPeer *peer=nullptr,std::string_view fragment={},bool newWindow=false);
|
||||
void textWindowOwnerClosed();
|
||||
bool cycleTextWindows(HWND current);
|
||||
bool cycleTextWindows(HWND current,bool reverse);
|
||||
}
|
||||
+1
-1
@@ -2,7 +2,7 @@
|
||||
#include "platform.h"
|
||||
namespace ks
|
||||
{
|
||||
inline constexpr wchar_t AppVersion[] = L"0.6.111";
|
||||
inline constexpr wchar_t AppVersion[] = L"0.6.114";
|
||||
inline constexpr UINT UpdateMessage = WM_APP + 7;
|
||||
inline constexpr UINT UpdateCheckIntervalMs = 6 * 60 * 60 * 1000;
|
||||
inline constexpr UINT UpdateNotificationRetryMs = 5 * 60 * 1000;
|
||||
|
||||
+86
-15
@@ -27,6 +27,22 @@ public static class FilesActivationUi {
|
||||
[DllImport("user32.dll")] static extern IntPtr GetDC(IntPtr window);
|
||||
[DllImport("user32.dll")] static extern int ReleaseDC(IntPtr window, IntPtr dc);
|
||||
[DllImport("gdi32.dll")] static extern uint GetPixel(IntPtr dc, int x, int y);
|
||||
[DllImport("user32.dll")] static extern bool GetWindowRect(IntPtr window, out Rect rect);
|
||||
[DllImport("user32.dll")] static extern IntPtr SetThreadDpiAwarenessContext(IntPtr context);
|
||||
|
||||
public static uint ReadScreenCenter(IntPtr window) {
|
||||
var previous = SetThreadDpiAwarenessContext(new IntPtr(-4));
|
||||
try {
|
||||
Rect bounds;
|
||||
if (!GetWindowRect(window, out bounds)) throw new InvalidOperationException("Missing terminal output.");
|
||||
var dc = GetDC(IntPtr.Zero);
|
||||
if (dc == IntPtr.Zero) throw new InvalidOperationException("Could not read the screen.");
|
||||
try { return GetPixel(dc, (bounds.Left + bounds.Right) / 2, (bounds.Top + bounds.Bottom) / 2); }
|
||||
finally { ReleaseDC(IntPtr.Zero, dc); }
|
||||
} finally {
|
||||
if (previous != IntPtr.Zero) SetThreadDpiAwarenessContext(previous);
|
||||
}
|
||||
}
|
||||
|
||||
public static bool HasWarningBackground(IntPtr window) {
|
||||
var dc = GetDC(window);
|
||||
@@ -35,6 +51,7 @@ public static class FilesActivationUi {
|
||||
finally { ReleaseDC(window, dc); }
|
||||
}
|
||||
[DllImport("user32.dll")] public static extern IntPtr GetForegroundWindow();
|
||||
[DllImport("user32.dll")] public static extern uint GetClipboardSequenceNumber();
|
||||
[DllImport("user32.dll")] static extern bool SetForegroundWindow(IntPtr window);
|
||||
[DllImport("user32.dll")] static extern void keybd_event(byte key, byte scan, uint flags, UIntPtr extra);
|
||||
[DllImport("user32.dll")] public static extern bool PostMessage(IntPtr window, uint msg, IntPtr w, IntPtr l);
|
||||
@@ -86,6 +103,19 @@ function Wait-Until([string]$Description, [scriptblock]$Condition) {
|
||||
throw "Timed out waiting for $Description"
|
||||
}
|
||||
|
||||
function Invoke-ClipboardOperation([scriptblock]$Operation) {
|
||||
for ($attempt = 1; $attempt -le 3; $attempt++) {
|
||||
try { return (& $Operation) }
|
||||
catch {
|
||||
# CLIPBRD_E_CANT_OPEN means another process is using the shared clipboard.
|
||||
if ($_.Exception.GetBaseException().HResult -ne 0x800401D0 -or
|
||||
$attempt -eq 3) { throw }
|
||||
[Windows.Forms.Application]::DoEvents()
|
||||
Start-Sleep -Milliseconds 25
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
function Find-OperationDialog($Owner, [int]$Control) {
|
||||
$candidate = [IntPtr]::Zero
|
||||
while ($true) {
|
||||
@@ -214,6 +244,18 @@ try {
|
||||
$profile.SetValue('StatusFields', 3)
|
||||
|
||||
if($TerminalOnly){
|
||||
$terminalPage = Join-Path $app 'terminal/index.html'
|
||||
$page = Get-Content -Raw -LiteralPath $terminalPage
|
||||
$page = $page.Replace('<style>','<style media="not all">').Replace('src="terminal.js"','src="startup-fixture.js"')
|
||||
[IO.File]::WriteAllText($terminalPage,$page)
|
||||
[IO.File]::WriteAllText((Join-Path $app 'terminal/startup-fixture.js'), @'
|
||||
function startTerminalFixture() {
|
||||
document.querySelector('style').media = 'all';
|
||||
const script = document.createElement('script');
|
||||
script.src = 'terminal.js';
|
||||
document.body.append(script);
|
||||
}
|
||||
'@)
|
||||
$listener=[Net.Sockets.TcpListener]::new([Net.IPAddress]::Loopback,0)
|
||||
$listener.Start()
|
||||
$port=$listener.LocalEndpoint.Port
|
||||
@@ -276,6 +318,29 @@ try {
|
||||
}
|
||||
if($SystemOpenOnly -or $TerminalOnly){
|
||||
$keys = New-Object -ComObject WScript.Shell
|
||||
if ($TerminalOnly) {
|
||||
Wait-Until 'Files active for the terminal startup check' {
|
||||
[FilesActivationUi]::Activate($window) -and [FilesActivationUi]::Focus($window) -eq $inputBox
|
||||
}
|
||||
$keys.SendKeys('^o')
|
||||
& $Node (Join-Path $PSScriptRoot 'files_markdown_browser.mjs') $port 'terminal-startup-pause'
|
||||
if ($LASTEXITCODE) { throw 'Could not pause terminal page initialization.' }
|
||||
foreach ($frame in 1..10) {
|
||||
if ([FilesActivationUi]::GetForegroundWindow() -ne $window -or
|
||||
![FilesActivationUi]::IsWindowVisible($output)) { throw 'The terminal must be visible for the startup check.' }
|
||||
$pixel = [FilesActivationUi]::ReadScreenCenter($output)
|
||||
if ($pixel -ne 0x181818) { throw ('Unexpected terminal startup background 0x{0:X6}.' -f $pixel) }
|
||||
Start-Sleep -Milliseconds 30
|
||||
}
|
||||
& $Node (Join-Path $PSScriptRoot 'files_markdown_browser.mjs') $port 'terminal-startup-resume'
|
||||
if ($LASTEXITCODE) { throw 'Could not resume terminal page initialization.' }
|
||||
Wait-Until 'the terminal rendering after startup' {
|
||||
Select-String -LiteralPath $trace -SimpleMatch ' web-anchor ' -Quiet -ErrorAction SilentlyContinue
|
||||
}
|
||||
$keys.SendKeys('^o')
|
||||
Wait-Until 'file panes restored after the startup check' { [FilesActivationUi]::IsWindowVisible($left) }
|
||||
Write-Output 'Verified the dark terminal background before WebView initialization completes.'
|
||||
}
|
||||
foreach($case in @(
|
||||
@{Name='enter-panes'; Keys='{ENTER}'},
|
||||
@{Name='shift-enter-panes'; Keys='+{ENTER}'},
|
||||
@@ -334,21 +399,21 @@ try {
|
||||
Send-InteractiveTerminal "Write-Output '$outputSelection'"
|
||||
Wait-Until 'output selection fixture command submitted' { !(Read-Text $inputBox) }
|
||||
Add-Type -AssemblyName System.Windows.Forms
|
||||
$savedClipboard = [Windows.Forms.Clipboard]::GetDataObject()
|
||||
$savedClipboard = Invoke-ClipboardOperation { [Windows.Forms.Clipboard]::GetDataObject() }
|
||||
try {
|
||||
$nativeDraft = "Get-Item -LiteralPath '$leftDir'"
|
||||
[void][FilesActivationUi]::Write($inputBox,0x0C,[IntPtr]::Zero,$nativeDraft)
|
||||
[void][FilesActivationUi]::Send($inputBox,0xB1,[IntPtr]0,[IntPtr]4)
|
||||
$keys.SendKeys('^{INSERT}')
|
||||
Wait-Until 'Ctrl+Insert copying the full command line with a partial selection' {
|
||||
[Windows.Forms.Clipboard]::GetText() -ceq $nativeDraft
|
||||
(Invoke-ClipboardOperation { [Windows.Forms.Clipboard]::GetText() }) -ceq $nativeDraft
|
||||
}
|
||||
$webviewDraft = "Get-Item -LiteralPath '$rightDir'"
|
||||
[void][FilesActivationUi]::Write($inputBox,0x0C,[IntPtr]::Zero,$webviewDraft)
|
||||
& $Node (Join-Path $PSScriptRoot 'files_markdown_browser.mjs') $port 'terminal-copy'
|
||||
if($LASTEXITCODE){throw 'Could not send Ctrl+Insert through the terminal WebView.'}
|
||||
Wait-Until 'Ctrl+Insert copying the command line with focus in the terminal WebView' {
|
||||
[Windows.Forms.Clipboard]::GetText() -ceq $webviewDraft
|
||||
(Invoke-ClipboardOperation { [Windows.Forms.Clipboard]::GetText() }) -ceq $webviewDraft
|
||||
}
|
||||
& $Node (Join-Path $PSScriptRoot 'files_markdown_browser.mjs') $port 'terminal-select-output'
|
||||
if($LASTEXITCODE){throw 'Could not select the terminal output fixture.'}
|
||||
@@ -356,22 +421,26 @@ try {
|
||||
[FilesActivationUi]::Focus($window) -eq $inputBox
|
||||
}
|
||||
foreach($key in '^c','^{INSERT}') {
|
||||
[Windows.Forms.Clipboard]::SetText($webviewDraft)
|
||||
# Require a new clipboard write without making the test process the clipboard owner.
|
||||
$beforeCopy = [FilesActivationUi]::GetClipboardSequenceNumber()
|
||||
$keys.SendKeys($key)
|
||||
Wait-Until "$key copying only the selected terminal output with a command present" {
|
||||
[Windows.Forms.Clipboard]::GetText() -ceq $outputSelection
|
||||
[FilesActivationUi]::GetClipboardSequenceNumber() -ne $beforeCopy -and
|
||||
(Invoke-ClipboardOperation { [Windows.Forms.Clipboard]::GetText() }) -ceq $outputSelection
|
||||
}
|
||||
if ((Read-Text $inputBox) -cne $webviewDraft) { throw 'Copying output changed the command line.' }
|
||||
}
|
||||
[void][FilesActivationUi]::Write($inputBox,0x0C,[IntPtr]::Zero,'')
|
||||
$keys.SendKeys('^{INSERT}')
|
||||
Wait-Until 'Ctrl+Insert copying the selected folder name when the command line is empty' {
|
||||
[Windows.Forms.Clipboard]::GetText() -ceq 'Test folder'
|
||||
(Invoke-ClipboardOperation { [Windows.Forms.Clipboard]::GetText() }) -ceq 'Test folder'
|
||||
}
|
||||
} finally {
|
||||
if ([Windows.Forms.Clipboard]::GetText() -cin @($nativeDraft,$webviewDraft,$outputSelection,'Test folder')) {
|
||||
if ($savedClipboard) { [Windows.Forms.Clipboard]::SetDataObject($savedClipboard,$true) }
|
||||
else { [Windows.Forms.Clipboard]::Clear() }
|
||||
Invoke-ClipboardOperation {
|
||||
if ([Windows.Forms.Clipboard]::GetText() -cin @($nativeDraft,$webviewDraft,$outputSelection,'Test folder')) {
|
||||
if ($savedClipboard) { [Windows.Forms.Clipboard]::SetDataObject($savedClipboard,$true) }
|
||||
else { [Windows.Forms.Clipboard]::Clear() }
|
||||
}
|
||||
}
|
||||
}
|
||||
Write-Output 'Verified Ctrl+C and Ctrl+Insert copy the selected output, then fall back to the command line or panel.'
|
||||
@@ -477,7 +546,7 @@ try {
|
||||
Write-Output 'Both panels refreshed external creation, modification and deletion while preserving focus.'
|
||||
|
||||
Add-Type -AssemblyName System.Windows.Forms
|
||||
$savedClipboard=[Windows.Forms.Clipboard]::GetDataObject()
|
||||
$savedClipboard=Invoke-ClipboardOperation { [Windows.Forms.Clipboard]::GetDataObject() }
|
||||
$programName=[IO.Path]::GetFileName($program)
|
||||
$expectedNames="Test folder`r`n$programName"
|
||||
try {
|
||||
@@ -490,18 +559,20 @@ try {
|
||||
}
|
||||
$shell.SendKeys('^{INSERT}')
|
||||
Wait-Until 'Ctrl+Insert copying marked names in panel order' {
|
||||
[Windows.Forms.Clipboard]::GetText() -ceq $expectedNames
|
||||
(Invoke-ClipboardOperation { [Windows.Forms.Clipboard]::GetText() }) -ceq $expectedNames
|
||||
}
|
||||
Select-Row $right $fileName
|
||||
$shell.SendKeys('^{INSERT}')
|
||||
Wait-Until 'Ctrl+Insert copying the current item in the other pane' {
|
||||
[Windows.Forms.Clipboard]::GetText() -ceq $fileName
|
||||
(Invoke-ClipboardOperation { [Windows.Forms.Clipboard]::GetText() }) -ceq $fileName
|
||||
}
|
||||
Write-Output 'Ctrl+Insert copied marked names in order and used the cursor in the other pane.'
|
||||
} finally {
|
||||
if ([Windows.Forms.Clipboard]::GetText() -cin @($expectedNames,$fileName)) {
|
||||
if ($savedClipboard) { [Windows.Forms.Clipboard]::SetDataObject($savedClipboard,$true) }
|
||||
else { [Windows.Forms.Clipboard]::Clear() }
|
||||
Invoke-ClipboardOperation {
|
||||
if ([Windows.Forms.Clipboard]::GetText() -cin @($expectedNames,$fileName)) {
|
||||
if ($savedClipboard) { [Windows.Forms.Clipboard]::SetDataObject($savedClipboard,$true) }
|
||||
else { [Windows.Forms.Clipboard]::Clear() }
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -54,10 +54,12 @@ public static class MarkdownUi {
|
||||
keybd_event(0x12,0,2,UIntPtr.Zero);
|
||||
SetForegroundWindow(window);
|
||||
}
|
||||
public static void CycleWindow() {
|
||||
public static void CycleWindow(bool reverse = false) {
|
||||
keybd_event(0x11,0,0,UIntPtr.Zero);
|
||||
if (reverse) keybd_event(0x10,0,0,UIntPtr.Zero);
|
||||
keybd_event(0x09,0,0,UIntPtr.Zero);
|
||||
keybd_event(0x09,0,2,UIntPtr.Zero);
|
||||
if (reverse) keybd_event(0x10,0,2,UIntPtr.Zero);
|
||||
keybd_event(0x11,0,2,UIntPtr.Zero);
|
||||
}
|
||||
[DllImport("user32.dll")] public static extern IntPtr GetDlgItem(IntPtr window, int id);
|
||||
@@ -328,8 +330,19 @@ const value = 42;
|
||||
Wait-Foreground $window
|
||||
Browser 'cycle' '' 'Preview.md'
|
||||
Wait-Foreground $child
|
||||
Browser 'cycle-reverse' '' 'Other.md'
|
||||
Wait-Foreground $window
|
||||
Browser 'edit' '' 'Preview.md'
|
||||
[void](Wait-For 'the first window to switch to Editor' { Find-Window 'KSwitcher.Files.Text' 'Editor' })
|
||||
[MarkdownUi]::CycleWindow($true)
|
||||
Wait-Foreground $main
|
||||
[MarkdownUi]::CycleWindow($true)
|
||||
Wait-Foreground $child
|
||||
Write-Output 'Verified backward Ctrl+Shift+Tab cycling through three windows and wrapping at Files.'
|
||||
Browser 'close' '' 'Other.md'
|
||||
[void](Wait-For 'Ctrl+W to close the Shift+click window' { ![MarkdownUi]::IsWindowVisible($child) })
|
||||
Post (Scintilla $window) 0x100 0x75
|
||||
Browser 'Перегляд Markdown' '' 'Preview.md'
|
||||
Browser 'follow'
|
||||
if ((Wait-For 'the in-place Markdown viewer' { Find-Window 'KSwitcher.Files.Text' 'Other.md' }) -ne $window) {
|
||||
throw 'A normal click did not stay in the same window.'
|
||||
|
||||
@@ -3,7 +3,7 @@ import { writeFile } from 'node:fs/promises';
|
||||
import { setTimeout as delay } from 'node:timers/promises';
|
||||
|
||||
const [port, scenario, artifact, title] = process.argv.slice(2);
|
||||
const terminalScenario = ['terminal-enter', 'terminal-copy', 'terminal-select-output'].includes(scenario);
|
||||
const terminalScenario = scenario.startsWith('terminal-');
|
||||
let socket;
|
||||
const pending = new Map();
|
||||
let sequence = 0;
|
||||
@@ -69,7 +69,10 @@ await new Promise((resolve, reject) => {
|
||||
});
|
||||
|
||||
try {
|
||||
if (scenario === 'terminal-select-output') {
|
||||
if (scenario === 'terminal-startup-pause' || scenario === 'terminal-startup-resume') {
|
||||
await waitFor(() => evaluate('typeof startTerminalFixture === "function"'), 'the delayed terminal page');
|
||||
if (scenario === 'terminal-startup-resume') await evaluate('startTerminalFixture()');
|
||||
} else if (scenario === 'terminal-select-output') {
|
||||
const selection = await waitFor(() => evaluate(`(() => {
|
||||
const marker = 'terminal-output-copy-fixture';
|
||||
const buffer = terminal.buffer.active;
|
||||
@@ -209,8 +212,9 @@ try {
|
||||
} else if (scenario === 'back' || scenario === 'forward') {
|
||||
await waitFor(() => evaluate(`!document.getElementById('${scenario}').disabled`), scenario);
|
||||
await evaluate(`document.getElementById('${scenario}').click()`);
|
||||
} else if (scenario === 'cycle') {
|
||||
await command('Input.dispatchKeyEvent', {type:'keyDown', key:'Tab', code:'Tab', modifiers:2, windowsVirtualKeyCode:9});
|
||||
} else if (scenario === 'cycle' || scenario === 'cycle-reverse') {
|
||||
const modifiers = scenario === 'cycle-reverse' ? 10 : 2;
|
||||
await command('Input.dispatchKeyEvent', {type:'keyDown', key:'Tab', code:'Tab', modifiers, windowsVirtualKeyCode:9});
|
||||
} else if (scenario === 'close') {
|
||||
await command('Input.dispatchKeyEvent', {type:'keyDown', key:'w', code:'KeyW', modifiers:2, windowsVirtualKeyCode:87});
|
||||
} else {
|
||||
|
||||
@@ -242,7 +242,7 @@ foreach($name in 'A.txt','B.txt','C.txt','D.txt'){
|
||||
$copy=Join-Path $scratch 'KSwitcher.Files.search-arrow-test.exe'
|
||||
Copy-Item -LiteralPath $Executable -Destination $copy
|
||||
$profile=[Microsoft.Win32.Registry]::CurrentUser.CreateSubKey('Software\KSwitcher\Files')
|
||||
$keysToRestore='LeftPath','RightPath','LeftCursor','RightCursor','WindowPlacement'
|
||||
$keysToRestore='LeftPath','RightPath','LeftCursor','RightCursor','WindowPlacement','FileStyles'
|
||||
$saved=@{}
|
||||
foreach($name in $keysToRestore){
|
||||
if($name -in $profile.GetValueNames()){
|
||||
@@ -256,6 +256,8 @@ try {
|
||||
$profile.SetValue('RightPath',$rightFixture)
|
||||
$profile.DeleteValue('LeftCursor',$false)
|
||||
$profile.DeleteValue('RightCursor',$false)
|
||||
$styles='[{"extension":".txt","background":3158064,"states":[{},{},{"background":3166352}]}]'
|
||||
$profile.SetValue('FileStyles',[Text.Encoding]::UTF8.GetBytes($styles),'Binary')
|
||||
$process=Start-Process -FilePath $copy -ArgumentList '--terminal-trace' -PassThru -WindowStyle Normal
|
||||
$paintTrace=Join-Path ([IO.Path]::GetTempPath()) "KSwitcher.Files.terminal-trace-$($process.Id).log"
|
||||
$previousDpi=[SearchArrowTest]::SetThreadDpiAwarenessContext([IntPtr](-4))
|
||||
@@ -290,12 +292,27 @@ try {
|
||||
Write-Output 'Verified folder navigation repaints only the panel that changes directories.'
|
||||
}
|
||||
$clicks=if(!$KeyboardCursorOnly){
|
||||
@(@{Panel=$leftPanel; Index=0},@{Panel=$rightPanel; Index=1},@{Panel=$rightPanel; Index=1})
|
||||
@(@{Panel=$leftPanel; Index=0},
|
||||
@{Panel=$rightPanel; Index=1; Label='A.txt'},
|
||||
@{Panel=$leftPanel; Index=0; Label='A.txt'},
|
||||
@{Panel=$rightPanel; Index=1; Label='..'; UnfocusedStyle=$true},
|
||||
@{Panel=$rightPanel; Index=1; Label='A.txt'})
|
||||
}
|
||||
$activeIndex=0
|
||||
foreach($check in $clicks) {
|
||||
$before=[SearchArrowTest]::Send($check.Panel,0x188,0,0).ToInt32()
|
||||
$top=[SearchArrowTest]::Send($check.Panel,0x18E,0,0).ToInt32()
|
||||
$row=if($before -eq $top){$top+1}else{$top}
|
||||
$row=if($check.Label){[SearchArrowTest]::SendText($check.Panel,0x1A2,-1,$check.Label).ToInt32()}
|
||||
elseif($before -eq $top){$top+1}else{$top}
|
||||
if($row -lt 0 -or $row -eq $before){throw 'The click fixture must move the cursor.'}
|
||||
$previousKey="$($check.Index)/$before"
|
||||
$expected=@{"$($check.Index)/$row"='1'}
|
||||
if($check.Index -ne $activeIndex){
|
||||
$source=if($activeIndex -eq 0){$leftPanel}else{$rightPanel}
|
||||
$sourceRow=[SearchArrowTest]::Send($source,0x188,0,0).ToInt32()
|
||||
$expected["$activeIndex/$sourceRow"]='0'
|
||||
}
|
||||
if($check.Index -eq $activeIndex -or $check.UnfocusedStyle){$expected[$previousKey]='0'}
|
||||
[void](Wait-Until { Test-Path -LiteralPath $paintTrace })
|
||||
Start-Sleep -Milliseconds 150
|
||||
$lineCount=@(Get-Content -LiteralPath $paintTrace).Count
|
||||
@@ -303,14 +320,15 @@ try {
|
||||
[void](Wait-Until { [SearchArrowTest]::Send($check.Panel,0x188,0,0).ToInt32() -eq $row })
|
||||
Start-Sleep -Milliseconds 150
|
||||
$highlight=Read-PanelHighlights $paintTrace $lineCount
|
||||
$draws=@($highlight.Keys)
|
||||
if("$($check.Index)/$row" -notin $draws -or $draws.Count -gt 3){
|
||||
throw "Clicking a row repainted unrelated file rows. Drawn rows: $draws"
|
||||
if($highlight.Count -ne $expected.Count -or
|
||||
@($expected.Keys | Where-Object {$highlight[$_] -ne $expected[$_]}).Count){
|
||||
throw "Unexpected cursor redraw. Expected rows: $($expected.Keys -join ', '). Drawn rows: $($highlight.Keys -join ', ')."
|
||||
}
|
||||
if($highlight["$($check.Index)/$row"] -ne '1' -or
|
||||
($before -ge $top -and $highlight["$($check.Index)/$before"] -ne '0')){
|
||||
throw 'The new row must be painted active and the previous visible row must lose its highlight.'
|
||||
if($check.Index -ne $activeIndex -and (Get-Content -LiteralPath $paintTrace | Select-Object -Skip $lineCount |
|
||||
Where-Object {$_ -match "^\d+ panel-draw $($check.Index) $before 1 "})){
|
||||
throw 'The old row in the destination panel flashed as the active cursor.'
|
||||
}
|
||||
$activeIndex=$check.Index
|
||||
}
|
||||
if($clicks){Write-Output 'Verified file clicks repaint only cursor rows in the active pane and when changing panes.'}
|
||||
Post $main 0x111 132
|
||||
|
||||
Reference in new issue
Block a user