Compare commits
18
Commits
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
23c49ce8bf | ||
|
|
a94c9dad14 | ||
|
|
553a2a0fa5 | ||
|
|
c01dfe8569 | ||
|
|
6b79f21a95 | ||
|
|
44b123b586 | ||
|
|
cb2f0a385b | ||
|
|
18c2b99dd5 | ||
|
|
2f7e97f13a | ||
|
|
a82a99d21e | ||
|
|
c9417e3d2c | ||
|
|
12e7b3e2fc | ||
|
|
d57b064d74 | ||
|
|
49ad7104fe | ||
|
|
cc6615cb74 | ||
|
|
66a69aa706 | ||
|
|
626fb685e5 | ||
|
|
8538c595e1 |
No files matched your search
+15
-1
@@ -1,5 +1,5 @@
|
||||
cmake_minimum_required(VERSION 3.24)
|
||||
project(KSwitcher VERSION 0.6.95 LANGUAGES CXX RC)
|
||||
project(KSwitcher VERSION 0.6.101 LANGUAGES CXX RC)
|
||||
if(NOT WIN32)
|
||||
message(FATAL_ERROR "KSwitcher uses native Windows APIs")
|
||||
endif()
|
||||
@@ -149,8 +149,20 @@ add_test(NAME files-activation-and-refresh
|
||||
-File "${CMAKE_CURRENT_SOURCE_DIR}/tests/files_activation.ps1"
|
||||
-Executable "$<TARGET_FILE:KSwitcherFiles>" -Fixture "$<TARGET_FILE:KSwitcherFilesActivationFixture>")
|
||||
set_tests_properties(files-activation-and-refresh PROPERTIES RUN_SERIAL TRUE TIMEOUT 120)
|
||||
add_test(NAME files-system-open
|
||||
COMMAND "${KSWITCHER_POWERSHELL}" -NoProfile -ExecutionPolicy Bypass
|
||||
-File "${CMAKE_CURRENT_SOURCE_DIR}/tests/files_activation.ps1"
|
||||
-Executable "$<TARGET_FILE:KSwitcherFiles>" -Fixture "$<TARGET_FILE:KSwitcherFilesActivationFixture>"
|
||||
-SystemOpenOnly)
|
||||
set_tests_properties(files-system-open PROPERTIES RUN_SERIAL TRUE TIMEOUT 60)
|
||||
find_program(KSWITCHER_NODE NAMES node)
|
||||
if(KSWITCHER_NODE)
|
||||
add_test(NAME files-terminal-enter
|
||||
COMMAND "${KSWITCHER_POWERSHELL}" -NoProfile -ExecutionPolicy Bypass
|
||||
-File "${CMAKE_CURRENT_SOURCE_DIR}/tests/files_activation.ps1"
|
||||
-Executable "$<TARGET_FILE:KSwitcherFiles>" -Fixture "$<TARGET_FILE:KSwitcherFilesActivationFixture>"
|
||||
-TerminalOnly -Node "${KSWITCHER_NODE}")
|
||||
set_tests_properties(files-terminal-enter PROPERTIES RUN_SERIAL TRUE TIMEOUT 90)
|
||||
add_executable(KSwitcherFilesMarkdownLanFixture WIN32 tests/files_markdown_lan.cpp
|
||||
src/files_text_window.cpp src/files_text_document.cpp src/files_text_language.cpp)
|
||||
target_include_directories(KSwitcherFilesMarkdownLanFixture PRIVATE
|
||||
@@ -187,6 +199,8 @@ else()
|
||||
target_link_options(KSwitcherChatProfileTests PRIVATE -static -static-libgcc -static-libstdc++)
|
||||
endif()
|
||||
add_test(NAME chat-profile-regressions COMMAND KSwitcherChatProfileTests)
|
||||
add_test(NAME lan-window-layout COMMAND KSwitcherChatProfileTests --lan-layout)
|
||||
set_tests_properties(lan-window-layout PROPERTIES RUN_SERIAL TRUE TIMEOUT 30)
|
||||
add_executable(KSwitcherHistoryHostTests tests/history_host.cpp)
|
||||
target_link_libraries(KSwitcherHistoryHostTests PRIVATE kscore psapi)
|
||||
set_target_properties(KSwitcherHistoryHostTests PROPERTIES RUNTIME_OUTPUT_DIRECTORY "${CMAKE_CURRENT_BINARY_DIR}/history-host-fixture-$<CONFIG>")
|
||||
|
||||
+15
-2
@@ -32,15 +32,28 @@ Warning і початковий фокус на No.
|
||||
окремим процесом. BAT і CMD виконуються в поточній сесії вбудованого
|
||||
термінала, а їхній вивід з’являється під панелями. Щоб відкрити файл із
|
||||
панелі LAN, спочатку скопіюй його до локальної папки.
|
||||
- Коли командний рядок порожній, Shift+Enter відкриває поточний локальний
|
||||
елемент через Windows.
|
||||
Папка відкривається у Провіднику, файл виконує свою стандартну дію Windows.
|
||||
|
||||
- У головному вікні клавіатурний фокус залишається в командному рядку.
|
||||
Tab перемикає активну панель, клік вибирає рядок, а стрілки вгору й вниз,
|
||||
Page Up і Page Down пересувають курсор у панелі навіть під час набору команди.
|
||||
Стрілки вліво й вправо переходять до першого й останнього рядків, коли
|
||||
командний рядок порожній.
|
||||
Клік оновлює підсвічування рядків курсора без перемальовування всієї панелі.
|
||||
Меню й діалоги тимчасово приймають фокус. Ctrl+V і Shift+Insert вставляють
|
||||
текст із буфера обміну в позицію курсора або замінюють виділення.
|
||||
Enter запускає введену команду або відкриває поточний елемент, якщо рядок
|
||||
порожній. Escape очищає рядок.
|
||||
Enter і Shift+Enter спочатку виконують введену команду. Коли рядок
|
||||
порожній, Enter відкриває поточний елемент. Якщо панелі приховано,
|
||||
Enter передає порожній рядок у термінал. Escape очищає рядок.
|
||||
Якщо фокус у виводі термінала, Enter і Shift+Enter повертають його до
|
||||
командного рядка й виконують відповідну дію за тими самими правилами.
|
||||
Промпт і текст команди вирівняні по спільній базовій лінії.
|
||||
- **F8 Delete** у нижньому рядку клавіш викликає той самий діалог видалення,
|
||||
що й клавіша F8.
|
||||
- У нижньому рядку, як у FAR, позначення клавіш сірі на чорному тлі,
|
||||
а назви дій темні на бірюзових сегментах.
|
||||
- У віддаленій панелі Enter запускає введену команду PowerShell на
|
||||
спареному ПК в поточному каталозі цієї панелі. Вивід і код завершення
|
||||
з’являються в терміналі Files як текст. Службовий прогрес PowerShell
|
||||
|
||||
@@ -39,6 +39,8 @@ the local resident process running and log downloads enabled on the remote PC.
|
||||
1. Install the v0.6.58 or newer on every participating PC. Input protocol v2 requires all participants to update; earlier one-pair builds cannot connect. Preserve local data; do not copy pairing identities between PCs.
|
||||
2. Open **Settings → Computers → Manage computers…** and enable discovery on both PCs.
|
||||
Only running LAN-enabled KSwitcher instances appear, not generic network devices.
|
||||
The computer list and pairing controls are on the left, the monitor grid and
|
||||
input sharing are on the right, and file, log and help actions are below.
|
||||
3. Match the computer name and instance-ID prefix displayed on the other PC.
|
||||
Select each other, generate one code, enter that same code on both, then click
|
||||
Pair on both within two minutes. Spaces, hyphens and uppercase hex are accepted.
|
||||
|
||||
Binary file not shown.
@@ -1,5 +1,41 @@
|
||||
# Latest Windows release
|
||||
|
||||
## v0.6.101 — 2026-11-16
|
||||
|
||||
In KSwitcher Files, Enter opens the selected item when the command line is empty, including when focus is in the terminal output. The Computers window places pairing and the monitor grid side by side so the bottom actions fit at high display scaling. This release replaces v0.6.100.
|
||||
|
||||
**Українською.** У KSwitcher Files Enter відкриває вибраний елемент, коли командний рядок порожній, зокрема коли фокус у виводі термінала. У вікні Computers спарювання та схема моніторів розташовані поруч, тож нижні дії поміщаються і при високому масштабі. Цей реліз замінює v0.6.100.
|
||||
|
||||
## v0.6.100 — 2026-11-16
|
||||
|
||||
In KSwitcher Files, Enter and Shift+Enter submit the command line when focus is in the terminal output. The terminal scrolls to the latest output when a command is submitted. While a LAN command is still running, Files shows how to cancel it and keeps the next command in the input field. This release replaces v0.6.99.
|
||||
|
||||
**Українською.** У KSwitcher Files Enter і Shift+Enter виконують введену команду, коли фокус у виводі термінала. Під час запуску команди термінал прокручується до останнього виводу. Поки виконується LAN-команда, Files показує, як її скасувати, і зберігає наступну команду в полі вводу. Цей реліз замінює v0.6.99.
|
||||
|
||||
## v0.6.99 — 2026-11-16
|
||||
|
||||
In KSwitcher Files, Enter and Shift+Enter run the command in the command line, including when the file panes are hidden. With visible panes and an empty command line, the keys act on the selected item. A command reveals the terminal output if it was hidden. This release replaces v0.6.98.
|
||||
|
||||
**Українською.** У KSwitcher Files Enter і Shift+Enter виконують команду з командного рядка, зокрема коли файлові панелі приховані. Коли панелі видимі й рядок порожній, клавіші діють на вибраний елемент. Якщо вивід термінала приховано, команда відкриває його. Цей реліз замінює v0.6.98.
|
||||
|
||||
## v0.6.98 — 2026-11-16
|
||||
|
||||
In Files, Enter opens folders in the current pane, uses the Windows default action for local files, and runs BAT and CMD in the embedded terminal. Shift+Enter opens local folders in File Explorer and passes files, including BAT and CMD, to Windows. It preserves the draft command. Left and Right clear the previous cursor highlight when jumping to the first or last row. The FAR-style key bar uses gray key labels on black and dark action names on teal.
|
||||
|
||||
**Українською.** У Files Enter відкриває папки в поточній панелі, викликає стандартну дію Windows для локальних файлів, а BAT і CMD запускає у вбудованому терміналі. Shift+Enter відкриває локальні папки у Провіднику й передає файли, зокрема BAT і CMD, Windows. Чернетка команди зберігається. Стрілки вліво й вправо скидають старе підсвічування при переході до першого чи останнього рядка. Нижній рядок клавіш у стилі FAR має сірі позначення клавіш на чорному тлі й темні назви дій на бірюзовому.
|
||||
|
||||
## v0.6.97 — 2026-11-16
|
||||
|
||||
KSwitcher Files clears the highlight from the previous cursor row after a selection change and highlights the new row. It keeps the targeted repaint introduced in v0.6.96. This release replaces v0.6.96.
|
||||
|
||||
**Українською.** KSwitcher Files знімає підсвічування з попереднього рядка курсора після зміни вибору й виділяє новий рядок. Панель і далі перемальовує лише потрібні рядки. Цей реліз замінює v0.6.96.
|
||||
|
||||
## v0.6.96 — 2026-11-16
|
||||
|
||||
Clicking a file row in Files now redraws only the affected cursor rows, including when switching panes. The key bar adds **F8 Delete**, which opens the same confirmation as pressing F8.
|
||||
|
||||
**Українською.** Клік по рядку у Files перемальовує лише рядки курсора, зокрема при переході на іншу панель. У нижньому рядку клавіш є **F8 Delete**, що відкриває той самий діалог підтвердження, що й клавіша F8.
|
||||
|
||||
## v0.6.95 — 2026-11-16
|
||||
|
||||
Files shows Markdown after rendering completes, refreshes local previews when the file changes on disk, and opens internal links in the same window. Shift+click opens a separate window. The arrow controls, mouse side buttons and Alt+Left/Right navigate history. Ctrl+W closes the viewer. Ctrl+Tab cycles through Files and its open editors and viewers. Up and Down wrap in Files menus and drop-downs. Manual and LAN updates close Files, editors, Settings and bundled StayHere from the target installation before replacing its files. Save open work before updating. When installing this release with an older updater, close Files and its separate windows first. This release replaces v0.6.94.
|
||||
|
||||
@@ -1 +1 @@
|
||||
22bda6ae5555a48bc23aeda7dafe6b132f22be17f0f4979f5e9cc83b366ea3ea KSwitcher-win-x64.zip
|
||||
b226b6956314530c4dfc68896ec385e06cb5a8f6709d9a555a6774efc8afed26 KSwitcher-win-x64.zip
|
||||
+77
-77
@@ -1,166 +1,166 @@
|
||||
{
|
||||
"schema": 1,
|
||||
"version": "0.6.101",
|
||||
"files": [
|
||||
{
|
||||
"path": "KSwitcher.exe",
|
||||
"size": 2361856,
|
||||
"sha256": "a267d8bd17f0247df78bffccf626919cdd91266f3b338a07f9fc3e7f747b0c5e",
|
||||
"path": "KSwitcher.exe"
|
||||
"sha256": "5ef419728079c2b45bbce6747ddbf6c8cbcf46134542613cdd22e81035b2c1d2"
|
||||
},
|
||||
{
|
||||
"size": 2359808,
|
||||
"sha256": "06f4baf81aa8b5f0158468ad51262b78cd75a5730ee8ed731036d11820a6121a",
|
||||
"path": "KSwitcher.Config.exe"
|
||||
"path": "KSwitcher.Config.exe",
|
||||
"size": 2359296,
|
||||
"sha256": "000cf951ebe18ff39b5521bbdbdf54176230b1dca5607fc97321aab4988fd26f"
|
||||
},
|
||||
{
|
||||
"path": "KSwitcher.Screenshot.exe",
|
||||
"size": 3337216,
|
||||
"sha256": "b9523a172b2902e5f8fe80328dd8ccda5f95be54f589d90826864b13fcf03de0",
|
||||
"path": "KSwitcher.Screenshot.exe"
|
||||
"sha256": "2310e016dad617fd97303abd03a9a04c91737ff0b43386aa58241dc96f883043"
|
||||
},
|
||||
{
|
||||
"size": 3736064,
|
||||
"sha256": "7f7379dc5ad9393aab0de48ba5ad4d5b1161e488a088fb11bac3ddfb1f7cb6d9",
|
||||
"path": "KSwitcher.Files.exe"
|
||||
"path": "KSwitcher.Files.exe",
|
||||
"size": 3739136,
|
||||
"sha256": "be0b8b9097f8406bdd468f652be1659ec61de8ce29b543046d710cbc63c4a888"
|
||||
},
|
||||
{
|
||||
"path": "WebView2Loader.dll",
|
||||
"size": 194912,
|
||||
"sha256": "d3fce90bdeecb08596e377dea6a316354dd8949e32ff09b89d51be00c14e21b6",
|
||||
"path": "WebView2Loader.dll"
|
||||
"sha256": "d3fce90bdeecb08596e377dea6a316354dd8949e32ff09b89d51be00c14e21b6"
|
||||
},
|
||||
{
|
||||
"path": "terminal/addon-fit-LICENSE.txt",
|
||||
"size": 1103,
|
||||
"sha256": "e256f01188af527e4d06d21d06fbf785ae9c50d4b328bf03cbe0ba7f0aa4228f",
|
||||
"path": "terminal/addon-fit-LICENSE.txt"
|
||||
"sha256": "e256f01188af527e4d06d21d06fbf785ae9c50d4b328bf03cbe0ba7f0aa4228f"
|
||||
},
|
||||
{
|
||||
"path": "terminal/addon-fit.js",
|
||||
"size": 1521,
|
||||
"sha256": "ba3ea256ce0620a0992a197d6c9baea64823fc93d8da07a9e366ca9943c18527",
|
||||
"path": "terminal/addon-fit.js"
|
||||
"sha256": "ba3ea256ce0620a0992a197d6c9baea64823fc93d8da07a9e366ca9943c18527"
|
||||
},
|
||||
{
|
||||
"path": "terminal/index.html",
|
||||
"size": 527,
|
||||
"sha256": "084d97a727b778fb10d31adcd557ee7840a38377ed60e0ef0f3ece93b349b1ef",
|
||||
"path": "terminal/index.html"
|
||||
"sha256": "084d97a727b778fb10d31adcd557ee7840a38377ed60e0ef0f3ece93b349b1ef"
|
||||
},
|
||||
{
|
||||
"path": "terminal/markdown-it-LICENSE.txt",
|
||||
"size": 1073,
|
||||
"sha256": "792c48c5a849a15fdf9e37e8bcf9e6d1dd13b32b46c642a748a0a46a9919d473",
|
||||
"path": "terminal/markdown-it-LICENSE.txt"
|
||||
"sha256": "792c48c5a849a15fdf9e37e8bcf9e6d1dd13b32b46c642a748a0a46a9919d473"
|
||||
},
|
||||
{
|
||||
"path": "terminal/markdown-it.js",
|
||||
"size": 100786,
|
||||
"sha256": "391f2aa638e75e6c7859d0a5c5650ef0956722a45998f17e05b83bc655778e1e",
|
||||
"path": "terminal/markdown-it.js"
|
||||
"sha256": "391f2aa638e75e6c7859d0a5c5650ef0956722a45998f17e05b83bc655778e1e"
|
||||
},
|
||||
{
|
||||
"size": 2212,
|
||||
"sha256": "27d3c6d39325d4995162911c352a8e20603513445683ceb0409e628949c39237",
|
||||
"path": "terminal/markdown.html"
|
||||
"path": "terminal/markdown.html",
|
||||
"size": 2171,
|
||||
"sha256": "b011e0872c869c48302a37b3e2e462addc1ee11e723f840ad7df1e893fc15336"
|
||||
},
|
||||
{
|
||||
"size": 6534,
|
||||
"sha256": "dbf9a062364dcc90b59fd98eb0adb0f153ed95accf26e28f7be9cce8c13ae324",
|
||||
"path": "terminal/markdown.js"
|
||||
"path": "terminal/markdown.js",
|
||||
"size": 6381,
|
||||
"sha256": "21cc15ceb2b8bee9b3f6a816d629677dab61243daf784c10b4c96312729cb149"
|
||||
},
|
||||
{
|
||||
"path": "terminal/mermaid-LICENSE.txt",
|
||||
"size": 1089,
|
||||
"sha256": "ec9fb67dcb25eccc416ed56e1aab819222c805a2a4bfe4cb19e7556bf2ffde80",
|
||||
"path": "terminal/mermaid-LICENSE.txt"
|
||||
"sha256": "ec9fb67dcb25eccc416ed56e1aab819222c805a2a4bfe4cb19e7556bf2ffde80"
|
||||
},
|
||||
{
|
||||
"path": "terminal/mermaid.js",
|
||||
"size": 5537838,
|
||||
"sha256": "336df803d87a38b70a01e736e666c8f7601d2ce42f5e47c8fafe5d721074b9a3",
|
||||
"path": "terminal/mermaid.js"
|
||||
"sha256": "336df803d87a38b70a01e736e666c8f7601d2ce42f5e47c8fafe5d721074b9a3"
|
||||
},
|
||||
{
|
||||
"size": 4478,
|
||||
"sha256": "0f3edde02b30e7b0f76d0cc88daae5791d720a4b74cf8b34e7c0b4dbe0cf9c9d",
|
||||
"path": "terminal/terminal.js"
|
||||
"path": "terminal/terminal.js",
|
||||
"size": 4835,
|
||||
"sha256": "27a8b3b7fd6e0797363a5241f8871e674d01293d53a7b21bd71dfae47aea4eec"
|
||||
},
|
||||
{
|
||||
"path": "terminal/xterm-LICENSE.txt",
|
||||
"size": 1261,
|
||||
"sha256": "b569f629d00f2626a8100df2a1798210535621e42164dfd426a6fe5aac7b0ccd",
|
||||
"path": "terminal/xterm-LICENSE.txt"
|
||||
"sha256": "b569f629d00f2626a8100df2a1798210535621e42164dfd426a6fe5aac7b0ccd"
|
||||
},
|
||||
{
|
||||
"path": "terminal/xterm.css",
|
||||
"size": 7112,
|
||||
"sha256": "854a7c0fb70e8b1a083c16797ab827299fb18744f5ad34f227b48337e33293c6",
|
||||
"path": "terminal/xterm.css"
|
||||
"sha256": "854a7c0fb70e8b1a083c16797ab827299fb18744f5ad34f227b48337e33293c6"
|
||||
},
|
||||
{
|
||||
"path": "terminal/xterm.js",
|
||||
"size": 488663,
|
||||
"sha256": "14903579ff54664cd72f8e8699e6961a6272c21863ec1c3b118cdc8af5d4a972",
|
||||
"path": "terminal/xterm.js"
|
||||
"sha256": "14903579ff54664cd72f8e8699e6961a6272c21863ec1c3b118cdc8af5d4a972"
|
||||
},
|
||||
{
|
||||
"path": "LICENSE",
|
||||
"size": 4401,
|
||||
"sha256": "d3c81140cce01c26bf6cbf52aa40e0825e1fa35b9a91d1387170a65d2597082c",
|
||||
"path": "LICENSE"
|
||||
"sha256": "d3c81140cce01c26bf6cbf52aa40e0825e1fa35b9a91d1387170a65d2597082c"
|
||||
},
|
||||
{
|
||||
"size": 1096,
|
||||
"sha256": "61e08da79c44061654015ce6b0c4061c23ee1dd18237fbf09e9bfda3c0ea2831",
|
||||
"path": "json-LICENSE.txt"
|
||||
"path": "json-LICENSE.txt",
|
||||
"size": 1075,
|
||||
"sha256": "c0d068392ea65358b798b8c165103560f06e9e3b38c4ab4e2d8810a7b931af86"
|
||||
},
|
||||
{
|
||||
"path": "files-text-license.txt",
|
||||
"size": 883,
|
||||
"sha256": "185c5a37521316e940ead89cbf0b1ba5862d810c7c966e6c6a14a4a515b23625",
|
||||
"path": "files-text-license.txt"
|
||||
"sha256": "185c5a37521316e940ead89cbf0b1ba5862d810c7c966e6c6a14a4a515b23625"
|
||||
},
|
||||
{
|
||||
"path": "README.md",
|
||||
"size": 94357,
|
||||
"sha256": "fca41227e9b38bf061298d69806ea66fb00086ae03aec49665e4f68ed2c3f8e9",
|
||||
"path": "README.md"
|
||||
"sha256": "fca41227e9b38bf061298d69806ea66fb00086ae03aec49665e4f68ed2c3f8e9"
|
||||
},
|
||||
{
|
||||
"size": 11418,
|
||||
"sha256": "2c13d3ed4761e679c352fb1ade24a1ec3060ad2862376ede801cdee5fcc3bada",
|
||||
"path": "LAN-PREVIEW.md"
|
||||
"path": "LAN-PREVIEW.md",
|
||||
"size": 11577,
|
||||
"sha256": "1233d6a0ed76564dd034f178a9f65db076244a819137f74dc9f2c27df9d3c930"
|
||||
},
|
||||
{
|
||||
"size": 732485,
|
||||
"sha256": "d0c022b27b9fbc2ff7b6b8bec723cc1adc4eef517202f9ff77eed5d8bea3acb9",
|
||||
"path": "dictionaries/en.txt"
|
||||
"path": "dictionaries/en.txt",
|
||||
"size": 682867,
|
||||
"sha256": "5f267c141c3d6837870e1c098f86b89a113ba300343119432644ead88f720c21"
|
||||
},
|
||||
{
|
||||
"size": 20566,
|
||||
"sha256": "0bdfb0201d1803634f268cdff0993b8349d2c70e956a06dbb667c8dd65254ec5",
|
||||
"path": "dictionaries/LICENSE-CC-BY-SA-4.0.txt"
|
||||
"path": "dictionaries/LICENSE-CC-BY-SA-4.0.txt",
|
||||
"size": 20138,
|
||||
"sha256": "28a9529c7d0bb4dc51f4bf5c116a3d16ef247a052f7591466768ddf563fd1cf5"
|
||||
},
|
||||
{
|
||||
"path": "dictionaries/README.md",
|
||||
"size": 2265,
|
||||
"sha256": "3017bf44d3be9d9dfab21bd6778aa52b7947e61acf9ce2bc86b41d6e949ac311",
|
||||
"path": "dictionaries/README.md"
|
||||
"sha256": "3017bf44d3be9d9dfab21bd6778aa52b7947e61acf9ce2bc86b41d6e949ac311"
|
||||
},
|
||||
{
|
||||
"size": 1109134,
|
||||
"sha256": "80e6b6a27815973535f7facb636c597eb845dfee45cfabfc4e9b3341b9332849",
|
||||
"path": "dictionaries/ru.txt"
|
||||
"path": "dictionaries/ru.txt",
|
||||
"size": 1060364,
|
||||
"sha256": "9ef922c7699569304a428f6aba0fd13a21341c0d0cb9561f37ef83c41577a28b"
|
||||
},
|
||||
{
|
||||
"path": "dictionaries/sources.json",
|
||||
"size": 1280,
|
||||
"sha256": "98e5b3fe7304e37705c9e5ff48b0b399ccb16e806736d21f09921b99e5f2a408",
|
||||
"path": "dictionaries/sources.json"
|
||||
"sha256": "98e5b3fe7304e37705c9e5ff48b0b399ccb16e806736d21f09921b99e5f2a408"
|
||||
},
|
||||
{
|
||||
"path": "dictionaries/uk.txt",
|
||||
"size": 940799,
|
||||
"sha256": "d30e990d6ec2983c04f3644a3c61c6c668e8c542323f5931916fdd55b916eebf",
|
||||
"path": "dictionaries/uk.txt"
|
||||
"sha256": "d30e990d6ec2983c04f3644a3c61c6c668e8c542323f5931916fdd55b916eebf"
|
||||
},
|
||||
{
|
||||
"path": "tools/README.txt",
|
||||
"size": 993,
|
||||
"sha256": "a34b5161a8315af037e1ec71d816bfc688f7c364141d4ee2347cf0515ef0c82a",
|
||||
"path": "tools/README.txt"
|
||||
"sha256": "a34b5161a8315af037e1ec71d816bfc688f7c364141d4ee2347cf0515ef0c82a"
|
||||
},
|
||||
{
|
||||
"path": "tools/StayHere.exe",
|
||||
"size": 134656,
|
||||
"sha256": "6ef5cf64708d62b7fc63c3c793cc99188a513433ff4774cae01dc014f6664376",
|
||||
"path": "tools/StayHere.exe"
|
||||
"sha256": "6ef5cf64708d62b7fc63c3c793cc99188a513433ff4774cae01dc014f6664376"
|
||||
},
|
||||
{
|
||||
"path": "tools/StayHere-README.md",
|
||||
"size": 2796,
|
||||
"sha256": "ba214e2aca7405e698b3ab21ceb1f41ce088edd996b3e30e4a9d58ff496f9413",
|
||||
"path": "tools/StayHere-README.md"
|
||||
"sha256": "ba214e2aca7405e698b3ab21ceb1f41ce088edd996b3e30e4a9d58ff496f9413"
|
||||
}
|
||||
],
|
||||
"version": "0.6.95",
|
||||
"schema": 1
|
||||
]
|
||||
}
|
||||
+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,95,0
|
||||
PRODUCTVERSION 0,6,95,0
|
||||
FILEVERSION 0,6,101,0
|
||||
PRODUCTVERSION 0,6,101,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.95"
|
||||
VALUE "FileVersion", "0.6.101"
|
||||
END
|
||||
END
|
||||
BLOCK "VarFileInfo"
|
||||
|
||||
@@ -3,7 +3,7 @@ const terminal = new Terminal({
|
||||
fontFamily: 'Consolas, monospace',
|
||||
fontSize: 16,
|
||||
cursorBlink: false,
|
||||
stdinDisabled: true,
|
||||
disableStdin: true,
|
||||
theme: { background: '#181818', foreground: '#e8e8e8' },
|
||||
});
|
||||
const fit = new FitAddon.FitAddon();
|
||||
@@ -51,6 +51,11 @@ function anchorOutput() {
|
||||
trace(2);
|
||||
}
|
||||
terminal.attachCustomKeyEventHandler(event => {
|
||||
if (event.type === 'keydown' && event.key === 'Enter' && !event.ctrlKey && !event.altKey && !event.metaKey) {
|
||||
if (!event.repeat) bridge.postMessage(event.shiftKey ? 'shift-enter' : 'enter');
|
||||
event.preventDefault();
|
||||
return false;
|
||||
}
|
||||
if (event.type !== 'keydown' || !event.ctrlKey || event.altKey || event.shiftKey || event.metaKey) return true;
|
||||
if (event.code === 'KeyO') bridge.postMessage('toggle');
|
||||
else if (event.code === 'ArrowUp') bridge.postMessage('grow');
|
||||
@@ -78,6 +83,11 @@ terminal.onScroll(() => {
|
||||
anchorOutput();
|
||||
});
|
||||
bridge.addEventListener('message', ({ data }) => {
|
||||
if (data === 'scroll-bottom') {
|
||||
terminal.scrollToBottom();
|
||||
anchorOutput();
|
||||
return;
|
||||
}
|
||||
if (data === 'trace:on' || data === 'trace:output') {
|
||||
traceEnabled = true;
|
||||
traceOutput = data === 'trace:output';
|
||||
|
||||
+184
-55
@@ -355,7 +355,12 @@ std::vector<CommandEntry> terminalHistory;
|
||||
size_t terminalHistoryIndex{};
|
||||
constexpr UINT_PTR transferHighlightTimer=1;
|
||||
unsigned transferHighlightPhase{};
|
||||
HWND status{}, commands[7]{};
|
||||
constexpr struct KeyBarCommand { int id; WPARAM key; const wchar_t *label; } keyBar[]{
|
||||
{110,VK_F2,L"Ctrl+R Refresh"}, {111,VK_F3,L"F3 View"}, {112,VK_F4,L"F4 Edit"},
|
||||
{113,VK_F5,L"F5 Copy"}, {114,VK_F6,L"F6 Move"}, {115,VK_F7,L"F7 Mkdir"},
|
||||
{117,VK_F8,L"F8 Delete"}, {116,VK_F10,L"F10 Exit"}
|
||||
};
|
||||
HWND status{}, commands[std::size(keyBar)]{};
|
||||
int active{}, split{};
|
||||
bool dragging{};
|
||||
bool rememberElevationApproval{};
|
||||
@@ -447,7 +452,7 @@ void openMenu(HWND window, int index);
|
||||
void showFileDetails(const Panel &panel);
|
||||
void editOptions(HWND owner);
|
||||
void showFolderShortcuts(Panel &panel,int digit,bool all=false);
|
||||
void layout(HWND window);
|
||||
void layout(HWND window,bool activeOnly=false);
|
||||
|
||||
DWORD preference(const wchar_t *name, DWORD fallback)
|
||||
{
|
||||
@@ -511,7 +516,6 @@ BOOL CALLBACK updateDialogFont(HWND window,LPARAM parameter)
|
||||
return TRUE;
|
||||
}
|
||||
HBRUSH blue{}, teal{}, terminalBackground{};
|
||||
void layout(HWND window);
|
||||
|
||||
LOGFONTW defaultFilesFont()
|
||||
{
|
||||
@@ -761,6 +765,7 @@ void hidePicker()
|
||||
void selectDrive();
|
||||
void showMenu(bool show)
|
||||
{
|
||||
if(!show && !IsWindowVisible(menuBar)) return;
|
||||
if (show) SetWindowPos(menuBar,HWND_TOP,0,0,0,0,SWP_NOMOVE|SWP_NOSIZE|SWP_SHOWWINDOW);
|
||||
for (auto item : menuItems)
|
||||
{
|
||||
@@ -829,7 +834,7 @@ void closePanelSearch()
|
||||
if(IsWindowVisible(panelSearchPopup)) ShowWindow(panelSearchPopup,SW_HIDE);
|
||||
}
|
||||
|
||||
void layout(HWND window)
|
||||
void layout(HWND window,bool activeOnly)
|
||||
{
|
||||
RECT rect{};
|
||||
GetClientRect(window, &rect);
|
||||
@@ -848,21 +853,24 @@ void layout(HWND window)
|
||||
if(control) SetWindowPos(control,nullptr,x,y,width,height,
|
||||
SWP_NOZORDER|SWP_NOACTIVATE|SWP_NOCOPYBITS|SWP_NOREDRAW);
|
||||
};
|
||||
for (int i = 0; i < 2; ++i)
|
||||
if(!activeOnly)
|
||||
{
|
||||
int x = i ? middle + 2 : 0;
|
||||
int end = i ? width : middle - 2;
|
||||
place(panels[i].path, x + 5, 4, std::max(0, end - x - 10), textHeight);
|
||||
int headingHeight=panels[i].wide?textHeight:0;
|
||||
place(panels[i].heading,x+5,textHeight+10,std::max(0,end-x-13),headingHeight);
|
||||
ShowWindow(panels[i].heading,!terminalVisible && panels[i].wide?SW_SHOWNA:SW_HIDE);
|
||||
place(panels[i].list, x + 5, textHeight+10+headingHeight, std::max(0, end - x - 13),
|
||||
std::max(0, panelBottom-textHeight-10-headingHeight));
|
||||
for (int i = 0; i < 2; ++i)
|
||||
{
|
||||
int x = i ? middle + 2 : 0;
|
||||
int end = i ? width : middle - 2;
|
||||
place(panels[i].path, x + 5, 4, std::max(0, end - x - 10), textHeight);
|
||||
int headingHeight=panels[i].wide?textHeight:0;
|
||||
place(panels[i].heading,x+5,textHeight+10,std::max(0,end-x-13),headingHeight);
|
||||
ShowWindow(panels[i].heading,!terminalVisible && panels[i].wide?SW_SHOWNA:SW_HIDE);
|
||||
place(panels[i].list, x + 5, textHeight+10+headingHeight, std::max(0, end - x - 13),
|
||||
std::max(0, panelBottom-textHeight-10-headingHeight));
|
||||
}
|
||||
place(menuBar,0,0,width,textHeight+4);
|
||||
const int menuEdges[]{0,7,15,27,38,46};
|
||||
for(int i=0;i<5;++i)
|
||||
place(menuItems[i],4+menuEdges[i]*cellWidth,0,(menuEdges[i+1]-menuEdges[i])*cellWidth,textHeight+4);
|
||||
}
|
||||
place(menuBar,0,0,width,textHeight+4);
|
||||
const int menuEdges[]{0,7,15,27,38,46};
|
||||
for(int i=0;i<5;++i)
|
||||
place(menuItems[i],4+menuEdges[i]*cellWidth,0,(menuEdges[i+1]-menuEdges[i])*cellWidth,textHeight+4);
|
||||
const int detailsLeft=active?middle+2:0;
|
||||
const int detailsRight=active?width:middle-2;
|
||||
place(status,detailsLeft+8,panelBottom+4,std::max(0,detailsRight-detailsLeft-16),textHeight);
|
||||
@@ -880,6 +888,14 @@ void layout(HWND window)
|
||||
const int promptWidth=std::min(width/2,static_cast<int>(promptExtent.cx));
|
||||
place(terminalPrompt,4,inputTop,promptWidth,textHeight);
|
||||
place(terminalInput,4+promptWidth,inputTop,std::max(0,width-8-promptWidth),textHeight);
|
||||
if(activeOnly)
|
||||
{
|
||||
const RECT details{0,panelBottom+4,width,panelBottom+4+textHeight};
|
||||
const RECT commandLine{0,inputTop,width,inputTop+textHeight};
|
||||
if(!terminalVisible) RedrawWindow(window,&details,nullptr,RDW_INVALIDATE|RDW_ALLCHILDREN);
|
||||
RedrawWindow(window,&commandLine,nullptr,RDW_INVALIDATE|RDW_ALLCHILDREN);
|
||||
return;
|
||||
}
|
||||
// Keep the WebView in place while the panels reveal more or less of it.
|
||||
place(terminalOutput,4,4,std::max(0,width-8),terminalBottom-4);
|
||||
if(showOutput)
|
||||
@@ -919,6 +935,22 @@ void showTerminal(HWND owner,bool show)
|
||||
|
||||
void open(Panel &panel,const fs::path &directory,bool offerElevation);
|
||||
void restoreCommandFocus();
|
||||
void submitTerminalReturn(HWND owner,bool shift);
|
||||
|
||||
void invalidatePanelRow(HWND list,LRESULT row)
|
||||
{
|
||||
RECT bounds{};
|
||||
if(row!=LB_ERR && SendMessageW(list,LB_GETITEMRECT,row,reinterpret_cast<LPARAM>(&bounds))!=LB_ERR)
|
||||
InvalidateRect(list,&bounds,FALSE);
|
||||
}
|
||||
|
||||
void invalidatePanelCursorChange(HWND list,LRESULT previous)
|
||||
{
|
||||
const auto current=SendMessageW(list,LB_GETCURSEL,0,0);
|
||||
if(current==previous) return;
|
||||
invalidatePanelRow(list,previous);
|
||||
invalidatePanelRow(list,current);
|
||||
}
|
||||
|
||||
void activatePanel(int index)
|
||||
{
|
||||
@@ -929,9 +961,9 @@ void activatePanel(int index)
|
||||
for(const auto &panel:panels)
|
||||
{
|
||||
InvalidateRect(panel.path,nullptr,FALSE);
|
||||
InvalidateRect(panel.list,nullptr,FALSE);
|
||||
invalidatePanelRow(panel.list,SendMessageW(panel.list,LB_GETCURSEL,0,0));
|
||||
}
|
||||
layout(GetParent(panels[index].list));
|
||||
layout(GetParent(panels[index].list),true);
|
||||
}
|
||||
|
||||
std::wstring terminalInputText()
|
||||
@@ -1068,6 +1100,8 @@ bool ensureTerminalView(HWND owner)
|
||||
{
|
||||
if(GetForegroundWindow()==owner) SetFocus(terminalInput);
|
||||
}
|
||||
else if(message==L"enter" || message==L"shift-enter")
|
||||
submitTerminalReturn(owner,message==L"shift-enter");
|
||||
else if(message==L"insert-path") insertCurrentPanelPath();
|
||||
else if(message==L"insert-name") insertCurrentPanelPath(true);
|
||||
else if(message==L"copy-command-line") SendMessageW(terminalInput,WM_COPY,0,0);
|
||||
@@ -1153,7 +1187,9 @@ bool submitTerminalCommand(const Panel &panel,const std::wstring &value)
|
||||
const auto owner=GetParent(panel.list);
|
||||
if(remoteCommandRunning)
|
||||
{
|
||||
setStatus(L"A remote command is running. Press Escape to cancel it.");
|
||||
constexpr auto busy=L"A remote command is running. Clear the command line and press Escape to cancel it.";
|
||||
setStatus(busy);
|
||||
if(terminalVisible) appendRemoteOutput(ks::utf8(std::wstring(L"\r\n")+busy+L"\r\n"));
|
||||
return false;
|
||||
}
|
||||
if(panel.peer)
|
||||
@@ -1210,6 +1246,24 @@ bool submitTerminalCommand(const Panel &panel,const std::wstring &value)
|
||||
return true;
|
||||
}
|
||||
|
||||
void runCommandLine()
|
||||
{
|
||||
const auto value=terminalInputText();
|
||||
if(!submitTerminalCommand(panels[active],value)) return;
|
||||
terminalView.post(L"scroll-bottom");
|
||||
if(value.find_first_not_of(L" \t\r\n")!=value.npos)
|
||||
{
|
||||
rememberCommand(value);
|
||||
if(!terminalVisible && terminalRows==0)
|
||||
{
|
||||
terminalRows=5;
|
||||
layout(GetParent(terminalInput));
|
||||
}
|
||||
}
|
||||
terminalHistoryIndex=terminalHistory.size();
|
||||
SetWindowTextW(terminalInput,L"");
|
||||
}
|
||||
|
||||
LRESULT CALLBACK terminalInputKeys(HWND input,UINT message,WPARAM wp,LPARAM lp,UINT_PTR,DWORD_PTR)
|
||||
{
|
||||
if(message==WM_COPY || (message==WM_CHAR && wp==3))
|
||||
@@ -1250,20 +1304,6 @@ LRESULT CALLBACK terminalInputKeys(HWND input,UINT message,WPARAM wp,LPARAM lp,U
|
||||
SendMessageW(input,EM_REPLACESEL,TRUE,reinterpret_cast<LPARAM>(L""));
|
||||
return 0;
|
||||
}
|
||||
if(message==WM_CHAR && wp==VK_RETURN)
|
||||
{
|
||||
if(!terminalVisible && !GetWindowTextLengthW(input))
|
||||
{
|
||||
SendMessageW(panels[active].list,WM_KEYDOWN,VK_RETURN,lp);
|
||||
return 0;
|
||||
}
|
||||
const auto value=terminalInputText();
|
||||
if(!submitTerminalCommand(panels[active],value)) return 0;
|
||||
if(value.find_first_not_of(L" \t\r\n")!=std::wstring::npos) rememberCommand(value);
|
||||
terminalHistoryIndex=terminalHistory.size();
|
||||
SetWindowTextW(input,L"");
|
||||
return 0;
|
||||
}
|
||||
if(message==WM_KEYDOWN && !terminalVisible && wp==VK_TAB)
|
||||
{
|
||||
activatePanel(1-active);
|
||||
@@ -2030,6 +2070,14 @@ void chooseDrive(int index,bool fromMenu)
|
||||
RedrawWindow(owner,nullptr,nullptr,RDW_INVALIDATE|RDW_ALLCHILDREN|RDW_UPDATENOW);
|
||||
}
|
||||
|
||||
void openPanelPathWithSystem(const Panel &panel,const fs::path &path,const wchar_t *verb,
|
||||
const wchar_t *failureMessage)
|
||||
{
|
||||
if (reinterpret_cast<INT_PTR>(ShellExecuteW(GetParent(panel.list), verb, path.c_str(), nullptr,
|
||||
panel.directory.c_str(), SW_SHOWNORMAL)) <= 32)
|
||||
setStatus(failureMessage);
|
||||
}
|
||||
|
||||
void openPanelFile(const Panel &panel, const fs::path &file, const wchar_t *verb, const wchar_t *failureMessage)
|
||||
{
|
||||
if(panel.peer)
|
||||
@@ -2059,9 +2107,21 @@ void openPanelFile(const Panel &panel, const fs::path &file, const wchar_t *verb
|
||||
return;
|
||||
}
|
||||
if(!verb && isExtension(L".exe")) verb=L"open";
|
||||
if (reinterpret_cast<INT_PTR>(ShellExecuteW(GetParent(panel.list), verb, file.c_str(), nullptr,
|
||||
panel.directory.c_str(), SW_SHOWNORMAL)) <= 32)
|
||||
setStatus(failureMessage);
|
||||
openPanelPathWithSystem(panel,file,verb,failureMessage);
|
||||
}
|
||||
|
||||
void openSelectedWithSystem(const Panel &panel)
|
||||
{
|
||||
const auto row=currentPanelRow(panel);
|
||||
if(row==LB_ERR) return;
|
||||
if(panel.peer)
|
||||
{
|
||||
setStatus(L"Select a local item before opening it with Windows.");
|
||||
return;
|
||||
}
|
||||
const bool folder=panel.sizes[row]==L"Folder" || panel.sizes[row]==L"Up";
|
||||
openPanelPathWithSystem(panel,panel.rows[row],folder?L"explore":nullptr,
|
||||
folder?L"Cannot open the selected folder in File Explorer.":L"Cannot open the selected file.");
|
||||
}
|
||||
|
||||
#include "files_dialog_input.inl"
|
||||
@@ -4396,16 +4456,38 @@ void makeFolder(HWND owner,Panel &panel)
|
||||
|
||||
LRESULT CALLBACK panelKeys(HWND window, UINT message, WPARAM wp, LPARAM lp, UINT_PTR, DWORD_PTR index)
|
||||
{
|
||||
if(message==WM_LBUTTONDOWN)
|
||||
if(message==WM_LBUTTONDOWN || message==WM_LBUTTONDBLCLK ||
|
||||
(message==WM_MOUSEMOVE && (wp&MK_LBUTTON) && GetCapture()==window))
|
||||
{
|
||||
auto &panel=panels[index];
|
||||
activatePanel(static_cast<int>(index));
|
||||
const auto count=SendMessageW(window,LB_GETCOUNT,0,0);
|
||||
RECT last{};
|
||||
if(count>0 && SendMessageW(window,LB_GETITEMRECT,count-1,reinterpret_cast<LPARAM>(&last))!=LB_ERR &&
|
||||
GET_Y_LPARAM(lp)>=last.bottom)
|
||||
if(!count || count==LB_ERR) 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)};
|
||||
RECT bounds{};
|
||||
const bool rowHit=!HIWORD(hit) && row<count &&
|
||||
SendMessageW(window,LB_GETITEMRECT,row,reinterpret_cast<LPARAM>(&bounds))!=LB_ERR &&
|
||||
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)
|
||||
{
|
||||
selectPanelEdge(panels[index],false);
|
||||
return 0;
|
||||
// The list box can draw synchronously before committing its new selection.
|
||||
SendMessageW(window,LB_SETCURSEL,target,0);
|
||||
invalidatePanelCursorChange(window,previous);
|
||||
}
|
||||
showFileDetails(panel);
|
||||
if(message==WM_LBUTTONDOWN) SetCapture(window);
|
||||
if(message==WM_LBUTTONDBLCLK && rowHit) enter(panel);
|
||||
return 0;
|
||||
}
|
||||
if(message==WM_LBUTTONUP && GetCapture()==window)
|
||||
{
|
||||
ReleaseCapture();
|
||||
restoreCommandFocus();
|
||||
return 0;
|
||||
}
|
||||
const bool rangeKey=wp==VK_UP || wp==VK_DOWN || wp==VK_LEFT || wp==VK_RIGHT;
|
||||
if(message==WM_KEYDOWN && (wp==VK_INSERT || (rangeKey && (GetKeyState(VK_SHIFT)&0x8000))))
|
||||
@@ -4433,8 +4515,11 @@ LRESULT CALLBACK panelKeys(HWND window, UINT message, WPARAM wp, LPARAM lp, UINT
|
||||
showFileDetails(panel);
|
||||
return 0;
|
||||
}
|
||||
if (message == WM_KEYDOWN && (wp == VK_LEFT || wp == VK_RIGHT))
|
||||
return scrollList(window, message, wp == VK_LEFT ? VK_HOME : VK_END, lp);
|
||||
if(message==WM_KEYDOWN)
|
||||
{
|
||||
if(wp==VK_LEFT) wp=VK_HOME;
|
||||
else if(wp==VK_RIGHT) wp=VK_END;
|
||||
}
|
||||
if(message==WM_SETFOCUS) activatePanel(static_cast<int>(index));
|
||||
if(message==WM_CHAR && wp>=32 && wp!=127)
|
||||
{
|
||||
@@ -4475,7 +4560,11 @@ LRESULT CALLBACK panelKeys(HWND window, UINT message, WPARAM wp, LPARAM lp, UINT
|
||||
return 0;
|
||||
}
|
||||
}
|
||||
const bool movesCursor=message==WM_KEYDOWN &&
|
||||
(wp==VK_UP || wp==VK_DOWN || wp==VK_PRIOR || wp==VK_NEXT || wp==VK_HOME || wp==VK_END);
|
||||
const auto previous=movesCursor?SendMessageW(window,LB_GETCURSEL,0,0):LB_ERR;
|
||||
auto result=scrollList(window, message, wp, lp);
|
||||
if(movesCursor) invalidatePanelCursorChange(window,previous);
|
||||
if(message==WM_LBUTTONUP && GetFocus()==window) restoreCommandFocus();
|
||||
if(message==WM_PAINT && panels[index].wide)
|
||||
{
|
||||
@@ -4728,14 +4817,33 @@ bool handlePanelSearchKey(HWND window,MSG &message)
|
||||
return message.wParam==VK_ESCAPE && !modified && !alt;
|
||||
}
|
||||
|
||||
bool commandLineAvailable(HWND owner)
|
||||
{
|
||||
return !copyInProgress && !commandHistoryWindow && !FilesModalDialog::activeFor(owner) &&
|
||||
!IsWindowVisible(menuBar) && !IsWindowVisible(picker);
|
||||
}
|
||||
|
||||
void restoreCommandFocus()
|
||||
{
|
||||
if(GetFocus()!=terminalInput && !GetCapture() && !copyInProgress &&
|
||||
!FilesModalDialog::activeFor(GetParent(terminalInput)) &&
|
||||
!commandHistoryWindow && !IsWindowVisible(menuBar) && !IsWindowVisible(picker))
|
||||
if(GetFocus()!=terminalInput && !GetCapture() && commandLineAvailable(GetParent(terminalInput)))
|
||||
SetFocus(terminalInput);
|
||||
}
|
||||
|
||||
void handleFilesReturn(bool shift)
|
||||
{
|
||||
closePanelSearch();
|
||||
if(terminalVisible || GetWindowTextLengthW(terminalInput)) runCommandLine();
|
||||
else if(shift) openSelectedWithSystem(panels[active]);
|
||||
else enter(panels[active]);
|
||||
}
|
||||
|
||||
void submitTerminalReturn(HWND owner,bool shift)
|
||||
{
|
||||
if(GetForegroundWindow()!=owner || !commandLineAvailable(owner)) return;
|
||||
SetFocus(terminalInput);
|
||||
handleFilesReturn(shift);
|
||||
}
|
||||
|
||||
LRESULT CALLBACK filesWindow(HWND window, UINT message, WPARAM wp, LPARAM lp)
|
||||
{
|
||||
if(message==filesPreferencesChanged)
|
||||
@@ -4838,10 +4946,9 @@ LRESULT CALLBACK filesWindow(HWND window, UINT message, WPARAM wp, LPARAM lp)
|
||||
SetTimer(window,directoryWatchTimer,200,nullptr);
|
||||
if (!mono || !blue || !teal || !menuBar || !picker || !pickerFrame || !status || !panelSearchPopup) return -1;
|
||||
SendMessageW(status, WM_SETFONT, reinterpret_cast<WPARAM>(mono), FALSE);
|
||||
const wchar_t *labels[]{L"Ctrl+R Refresh", L"F3 View", L"F4 Edit", L"F5 Copy", L"F6 Move", L"F7 Mkdir", L"F10 Exit"};
|
||||
for (int i = 0; i < static_cast<int>(std::size(commands)); ++i)
|
||||
commands[i] = CreateWindowW(L"BUTTON", labels[i], WS_CHILD | WS_VISIBLE | BS_OWNERDRAW,
|
||||
0, 0, 0, 0, window, reinterpret_cast<HMENU>(110 + static_cast<INT_PTR>(i)), instance, nullptr);
|
||||
commands[i] = CreateWindowW(L"BUTTON", keyBar[i].label, WS_CHILD | WS_VISIBLE | BS_OWNERDRAW,
|
||||
0, 0, 0, 0, window, reinterpret_cast<HMENU>(static_cast<INT_PTR>(keyBar[i].id)), instance, nullptr);
|
||||
for (int i = 0; i < 2; ++i)
|
||||
{
|
||||
auto &panel = panels[i];
|
||||
@@ -5106,6 +5213,19 @@ LRESULT CALLBACK filesWindow(HWND window, UINT message, WPARAM wp, LPARAM lp)
|
||||
GetWindowTextW(item.hwndItem,label,64);
|
||||
text=label;
|
||||
}
|
||||
if(std::find(std::begin(commands),std::end(commands),item.hwndItem)!=std::end(commands))
|
||||
{
|
||||
const auto separator=text.find(L' ');
|
||||
auto key=text.substr(0,separator);
|
||||
if(key.starts_with(L'F') && key.size()>1) key.erase(0,1);
|
||||
auto shortcut=item.rcItem, action=item.rcItem;
|
||||
shortcut.right=std::min(shortcut.right,shortcut.left+static_cast<LONG>(key.size())*cellWidth+8);
|
||||
action.left=shortcut.right;
|
||||
paintText(item.hDC,shortcut,key.c_str(),RGB(184,184,184),RGB(0,0,0));
|
||||
if(action.left<action.right)
|
||||
paintText(item.hDC,action,text.c_str()+separator+1,colors[Selection],colors[Footer]);
|
||||
return TRUE;
|
||||
}
|
||||
auto background=item.CtlType==ODT_BUTTON?Footer:item.hwndItem==picker?Dialog:PanelBlue;
|
||||
auto foreground=colors[Text];
|
||||
if(item.hwndItem==picker && commandPicker && item.itemID<commandActions.size() && commandActions[item.itemID]<0)
|
||||
@@ -5139,6 +5259,7 @@ LRESULT CALLBACK filesWindow(HWND window, UINT message, WPARAM wp, LPARAM lp)
|
||||
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))
|
||||
background=Selection;
|
||||
@@ -5296,17 +5417,16 @@ LRESULT CALLBACK filesWindow(HWND window, UINT message, WPARAM wp, LPARAM lp)
|
||||
openMenu(window,LOWORD(wp)-130);
|
||||
return 0;
|
||||
}
|
||||
if (LOWORD(wp) >= 110 && LOWORD(wp) < 110+std::size(commands) && HIWORD(wp) == BN_CLICKED)
|
||||
if (HIWORD(wp) == BN_CLICKED)
|
||||
{
|
||||
const WPARAM keys[]{VK_F2, VK_F3, VK_F4, VK_F5, VK_F6, VK_F7, VK_F10};
|
||||
SendMessageW(panels[active].list, WM_KEYDOWN, keys[LOWORD(wp) - 110], 0);
|
||||
for(const auto &command:keyBar)
|
||||
if(LOWORD(wp)==command.id) SendMessageW(panels[active].list,WM_KEYDOWN,command.key,0);
|
||||
}
|
||||
if (LOWORD(wp) >= 102 && LOWORD(wp) <= 103 && HIWORD(wp) == LBN_DBLCLK)
|
||||
enter(panels[LOWORD(wp) - 102]);
|
||||
if (LOWORD(wp) >= 102 && LOWORD(wp) <= 103 && HIWORD(wp) == LBN_SELCHANGE)
|
||||
{
|
||||
const auto &panel=panels[LOWORD(wp) - 102];
|
||||
InvalidateRect(panel.list,nullptr,FALSE);
|
||||
showFileDetails(panel);
|
||||
}
|
||||
return 0;
|
||||
@@ -5427,6 +5547,15 @@ int WINAPI wWinMain(HINSTANCE instance, HINSTANCE, PWSTR, int show)
|
||||
if(message.hwnd==window && message.message>=WM_KEYFIRST && message.message<=WM_KEYLAST &&
|
||||
GetFocus()==terminalInput)
|
||||
message.hwnd=terminalInput;
|
||||
if(message.message==WM_KEYDOWN && message.wParam==VK_RETURN &&
|
||||
!(GetKeyState(VK_CONTROL)&0x8000) &&
|
||||
!(GetKeyState(VK_MENU)&0x8000) && !(GetKeyState(VK_LWIN)&0x8000) &&
|
||||
!(GetKeyState(VK_RWIN)&0x8000) && commandLineAvailable(window) &&
|
||||
(message.hwnd==terminalInput || message.hwnd==panels[0].list || message.hwnd==panels[1].list))
|
||||
{
|
||||
if(!(message.lParam & (1LL<<30))) handleFilesReturn((GetKeyState(VK_SHIFT)&0x8000)!=0);
|
||||
continue;
|
||||
}
|
||||
if(!copyInProgress && handlePanelSearchKey(window,message)) continue;
|
||||
if(!copyInProgress && !commandHistoryWindow && !FilesModalDialog::activeFor(window) && !terminalVisible &&
|
||||
message.message==WM_SYSKEYDOWN && (message.wParam==VK_F3 || message.wParam==VK_F4) &&
|
||||
|
||||
+50
-41
@@ -91,14 +91,8 @@ void refreshLan(HWND w,LanView &v)
|
||||
for(const auto &peer:next["peers"])
|
||||
{
|
||||
auto id=peer.at("id").get<std::string>();ids.push_back(id);
|
||||
std::wstring state=L"Not paired";
|
||||
if(peer.at("paired").get<bool>()){
|
||||
bool connected=next.value("inputReady",nlohmann::json::object()).contains(id);
|
||||
state=connected?L"Pair saved — input connected":
|
||||
!next.value("shareInput",false)?L"Pair saved — input disabled here":
|
||||
!peer.value("online",false)?L"Pair saved — computer offline":L"Pair saved — input not connected";
|
||||
}
|
||||
rows.push_back(wide(peer.at("name").get<std::string>())+L" ["+wide(id.substr(0,8))+L"] — "+state);
|
||||
rows.push_back(wide(peer.at("name").get<std::string>())+L" ["+wide(id.substr(0,8))+L"]"+
|
||||
(peer.at("paired").get<bool>()?L" — Paired":L""));
|
||||
}
|
||||
// Presence/challenge refreshes must not repaint or reset the pairing list.
|
||||
if(v.ids!=ids||v.rows!=rows)
|
||||
@@ -131,11 +125,21 @@ void refreshLan(HWND w,LanView &v)
|
||||
std::wstring peerName;
|
||||
for(const auto &peer:v.snapshot["peers"])
|
||||
if(peer.at("id")==v.snapshot.value("pendingPeer",std::string{}))peerName=wide(peer.at("name").get<std::string>());
|
||||
pairingStatus=L"Waiting for "+peerName+L" ("+std::to_wstring(v.snapshot.value("pairSecondsRemaining",0))+L" s).\nEnter the same code and click Pair there too. Pair is not saved yet.";
|
||||
pairingStatus=L"Waiting for "+peerName+L" ("+std::to_wstring(v.snapshot.value("pairSecondsRemaining",0))+L" s).\nEnter the same code and click Pair on the other PC.";
|
||||
}
|
||||
value(w,708,v.error.empty() ? pairingStatus : v.error);
|
||||
value(w,705,pending ? L"Waiting..." : L"&Pair");
|
||||
value(w,710,v.ids.empty() ? (enabled ? L"No KSwitcher found. Enable discovery on the other PC too. UDP 45883 must be allowed on your private network." : L"Discovery is disabled on this computer.") : L"Select the matching KSwitcher name and ID shown on the other computer.");
|
||||
const wchar_t *peerStatus=L"Select the name and ID shown on the other PC.";
|
||||
if(v.ids.empty()) peerStatus=enabled?L"No computers found. Enable discovery on both PCs and allow UDP 45883.":
|
||||
L"Discovery is disabled on this computer.";
|
||||
else if(paired)
|
||||
{
|
||||
const bool connected=v.snapshot.value("inputReady",nlohmann::json::object()).contains(selected);
|
||||
peerStatus=connected?L"Pair saved — input connected":
|
||||
!v.snapshot.value("shareInput",false)?L"Pair saved — input disabled here":
|
||||
!online?L"Pair saved — computer offline":L"Pair saved — input not connected";
|
||||
}
|
||||
value(w,710,peerStatus);
|
||||
EnableWindow(GetDlgItem(w,705),enabled&&online&&!pending&&!paired);
|
||||
EnableWindow(GetDlgItem(w,706),pending);
|
||||
EnableWindow(GetDlgItem(w,707),paired);
|
||||
@@ -157,8 +161,7 @@ void refreshLan(HWND w,LanView &v)
|
||||
EnableWindow(GetDlgItem(w,716),v.snapshot.value("shareInput",false));
|
||||
auto gridState=positions.dump()+v.snapshot["peers"].dump()+selected+v.snapshot.value("controlPeer",std::string{})+v.snapshot.value("inputReady",nlohmann::json::object()).dump()+(v.snapshot.value("shareInput",false)?"1":"0");
|
||||
if(gridState!=v.gridState){v.gridState=std::move(gridState);InvalidateRect(GetDlgItem(w,721),nullptr,FALSE);}
|
||||
std::wstring detail=L"Drag paired monitors to empty cells. This PC stays fixed. Arrow keys also work.";
|
||||
detail=L"Drag monitors to neighboring cells. Mouse crosses shared edges; empty cells block passage.";
|
||||
const std::wstring detail=L"Drag monitors or use arrow keys. The pointer crosses shared edges.";
|
||||
value(w,719,v.error.empty()?detail:v.error);
|
||||
auto inputStatus=wide(v.snapshot.value("inputStatus",std::string("Input sharing disabled.")));
|
||||
if(!v.snapshot.value("shareInput",false))
|
||||
@@ -257,38 +260,44 @@ LRESULT CALLBACK lanProc(HWND w,UINT msg,WPARAM wp,LPARAM lp)
|
||||
}
|
||||
void showLan(HWND parent,App &app)
|
||||
{
|
||||
HWND w=makeWindow(app,L"KSwitcher.LAN",L"KSwitcher computers",lanProc,740,908,0,false);
|
||||
HWND w=makeWindow(app,L"KSwitcher.LAN",L"KSwitcher computers",lanProc,730,498,0,false);
|
||||
windowLayoutState(w)->fixedClient=true;
|
||||
SetWindowLongPtrW(w,GWLP_HWNDPARENT,(LONG_PTR)parent);
|
||||
auto v=new LanView{parent,&app};SetWindowLongPtrW(w,GWLP_USERDATA,(LONG_PTR)v);
|
||||
label(w,L"Changes here save automatically. No need to click Save in Settings.",18,16,700);
|
||||
control(w,L"STATIC",L"",0,709,18,45,700,24);
|
||||
button(w,L"&Enable discovery",701,18,78,210);
|
||||
label(w,L"Only enabled KSwitcher instances announce themselves.",244,82,470);
|
||||
control(w,L"LISTBOX",L"",WS_TABSTOP|WS_VSCROLL|WS_BORDER|LBS_NOTIFY|LBS_NOINTEGRALHEIGHT,702,18,120,700,96);
|
||||
control(w,L"STATIC",L"",0,710,18,224,700,40);
|
||||
label(w,L"Same pairing c&ode on both computers",18,273,700);
|
||||
edit(w,703,18,301,470);SendDlgItemMessageW(w,703,EM_SETLIMITTEXT,80,0);
|
||||
button(w,L"&Generate code",704,504,300,214);
|
||||
label(w,L"Generate once, enter that code on both PCs, select each other, then click Pair on both.",18,338,700);
|
||||
button(w,L"&Pair",705,18,370,140);button(w,L"Cancel &pairing",706,174,370,160);button(w,L"&Forget pair",707,350,370,160);
|
||||
control(w,L"STATIC",L"",0,708,18,412,700,40);
|
||||
label(w,L"Arrange your computers",18,458,700);
|
||||
label(w,L"Changes save automatically.",16,12,698);
|
||||
control(w,L"STATIC",L"",0,709,16,35,698,22);
|
||||
|
||||
button(w,L"&Enable discovery",701,16,62,164);
|
||||
control(w,L"LISTBOX",L"",WS_TABSTOP|WS_VSCROLL|WS_BORDER|LBS_NOTIFY|LBS_NOINTEGRALHEIGHT,702,16,98,332,70);
|
||||
control(w,L"STATIC",L"",0,710,16,173,332,36);
|
||||
label(w,L"Same pairing c&ode on both computers",16,211,332);
|
||||
edit(w,703,16,234,189);SendDlgItemMessageW(w,703,EM_SETLIMITTEXT,80,0);
|
||||
button(w,L"&Generate code",704,213,234,135);
|
||||
button(w,L"&Pair",705,16,268,76);
|
||||
button(w,L"Cancel &pairing",706,100,268,125);
|
||||
button(w,L"&Forget pair",707,233,268,115);
|
||||
control(w,L"STATIC",L"Use one code on both PCs. Select each other and click Pair on both.",0,0,16,302,332,37);
|
||||
control(w,L"STATIC",L"",0,708,16,344,332,53);
|
||||
|
||||
constexpr int right=366,rightWidth=348,gridTop=92,gridHeight=185;
|
||||
label(w,L"Arrange your computers",right,65,rightWidth);
|
||||
WNDCLASSW gridClass{};gridClass.lpfnWndProc=lanGridProc;gridClass.hInstance=app.instance;gridClass.hCursor=LoadCursorW(nullptr,IDC_ARROW);gridClass.lpszClassName=L"KSwitcher.LAN.Layout";RegisterClassW(&gridClass);
|
||||
auto grid=CreateWindowExW(0,gridClass.lpszClassName,L"Computer layout. Select a computer above, then drag its monitor or use arrow keys.",WS_CHILD|WS_VISIBLE|WS_TABSTOP|WS_BORDER,
|
||||
scale(w,18),scale(w,486),scale(w,700),scale(w,180),w,reinterpret_cast<HMENU>(721),app.instance,v);
|
||||
windowLayoutState(w)->controls.push_back({grid,{18,486,718,666}});
|
||||
control(w,L"STATIC",L"",0,719,18,674,700,24);
|
||||
button(w,L"Enable &input sharing",715,18,706,330);
|
||||
button(w,L"&Stop input sharing",716,370,706,240);
|
||||
control(w,L"STATIC",L"",0,718,18,744,700,30);
|
||||
button(w,L"Send file…",726,18,774,144);
|
||||
button(w,L"Incoming files…",730,174,774,160);
|
||||
button(w,L"Download log…",727,346,774,164);
|
||||
button(w,L"Previous log…",728,522,774,196);
|
||||
control(w,L"BUTTON",L"Allow paired computers to download diagnostic logs",BS_AUTOCHECKBOX|WS_TABSTOP,729,18,808,700,24);
|
||||
control(w,L"STATIC",L"",0,731,18,835,700,24);
|
||||
button(w,L"Connection &help",722,18,864,300);
|
||||
button(w,L"&Close",IDCANCEL,618,864,100);
|
||||
auto grid=CreateWindowExW(0,gridClass.lpszClassName,L"Computer layout. Select a computer in the list, then drag its monitor or use arrow keys.",WS_CHILD|WS_VISIBLE|WS_TABSTOP|WS_BORDER,
|
||||
scale(w,right),scale(w,gridTop),scale(w,rightWidth),scale(w,gridHeight),w,reinterpret_cast<HMENU>(721),app.instance,v);
|
||||
windowLayoutState(w)->controls.push_back({grid,{right,gridTop,right+rightWidth,gridTop+gridHeight}});
|
||||
control(w,L"STATIC",L"",0,719,right,283,rightWidth,37);
|
||||
button(w,L"Enable &input sharing",715,right,323,172);
|
||||
button(w,L"&Stop input sharing",716,546,323,168);
|
||||
control(w,L"STATIC",L"",0,718,right,357,rightWidth,40);
|
||||
|
||||
button(w,L"Send file…",726,16,403,168);
|
||||
button(w,L"Incoming files…",730,192,403,168);
|
||||
button(w,L"Download log…",727,368,403,168);
|
||||
button(w,L"Previous log…",728,544,403,170);
|
||||
control(w,L"STATIC",L"",0,731,16,436,698,20);
|
||||
checkbox(w,L"Allow paired computers to download diagnostic logs",729,16,464,418);
|
||||
button(w,L"Connection &help",722,444,460,162);
|
||||
button(w,L"&Close",IDCANCEL,614,460,100);
|
||||
EnableWindow(parent,FALSE);showRequestedWindow(w);SetForegroundWindow(w);
|
||||
SetTimer(w,1,1000,nullptr);
|
||||
try {refreshLan(w,*v);} catch(const std::exception &e){v->error=wide(e.what());value(w,708,v->error);}
|
||||
|
||||
+1
-1
@@ -2,7 +2,7 @@
|
||||
#include "platform.h"
|
||||
namespace ks
|
||||
{
|
||||
inline constexpr wchar_t AppVersion[] = L"0.6.95";
|
||||
inline constexpr wchar_t AppVersion[] = L"0.6.101";
|
||||
inline constexpr UINT UpdateMessage = WM_APP + 7;
|
||||
inline constexpr UINT UpdateCheckIntervalMs = 6 * 60 * 60 * 1000;
|
||||
inline constexpr UINT UpdateNotificationRetryMs = 5 * 60 * 1000;
|
||||
|
||||
+59
-2
@@ -22,6 +22,56 @@ void require(bool ok, const char *message)
|
||||
if (!ok) throw std::runtime_error(message);
|
||||
++passed;
|
||||
}
|
||||
void lanWindowLayoutChecks(const std::filesystem::path &root)
|
||||
{
|
||||
const std::string peer(32,'b');
|
||||
const nlohmann::json fixture={{"version",1},{"id",std::string(32,'a')},{"enabled",false},
|
||||
{"trusted",{{peer,{{"name","Paired desktop"},{"key",std::string(64,'f')}}}}},
|
||||
{"positions",{{peer,nlohmann::json::array({1,0})}}}};
|
||||
const auto data=fixture.dump();
|
||||
std::filesystem::create_directories(root);
|
||||
ks::atomicWrite(root/L"lan-pairing.bin",ks::protect(ks::Bytes(data.begin(),data.end())));
|
||||
ks::App app(GetModuleHandleW(nullptr),true,root);
|
||||
ks::showSettings(app);
|
||||
SendMessageW(app.settingsWindow,WM_COMMAND,262,0);
|
||||
HWND lan=findTestWindow(L"KSwitcher.LAN",nullptr);
|
||||
require(lan!=nullptr,"Computers window opens");
|
||||
const auto dpi=GetDpiForWindow(lan);
|
||||
RECT room{0,0,MulDiv(750,dpi,96),MulDiv(510,dpi,96)};
|
||||
AdjustWindowRectExForDpi(&room,GetWindowLongPtrW(lan,GWL_STYLE)&~(WS_HSCROLL|WS_VSCROLL),
|
||||
FALSE,GetWindowLongPtrW(lan,GWL_EXSTYLE),dpi);
|
||||
RECT frame{};GetWindowRect(lan,&frame);
|
||||
SetWindowPos(lan,nullptr,0,0,std::min(frame.right-frame.left,room.right-room.left),
|
||||
std::min(frame.bottom-frame.top,room.bottom-room.top),SWP_NOMOVE|SWP_NOZORDER|SWP_NOACTIVATE);
|
||||
require(!(GetWindowLongPtrW(lan,GWL_STYLE)&(WS_HSCROLL|WS_VSCROLL)),"Computers window fits without scrollbars");
|
||||
RECT client{};GetClientRect(lan,&client);
|
||||
std::vector<std::pair<int,RECT>> placed;
|
||||
for(HWND child=GetWindow(lan,GW_CHILD);child;child=GetWindow(child,GW_HWNDNEXT))
|
||||
{
|
||||
RECT bounds{};GetWindowRect(child,&bounds);
|
||||
MapWindowPoints(nullptr,lan,reinterpret_cast<POINT *>(&bounds),2);
|
||||
require(bounds.left>=0&&bounds.top>=0&&bounds.right<=client.right&&bounds.bottom<=client.bottom,
|
||||
"Computers control is fully visible");
|
||||
const int id=GetDlgCtrlID(child);
|
||||
for(const auto &[otherId,other]:placed)
|
||||
{
|
||||
RECT overlap{};
|
||||
if(IntersectRect(&overlap,&bounds,&other))
|
||||
throw std::runtime_error("Computers controls overlap: "+std::to_string(id)+" and "+std::to_string(otherId)+
|
||||
" at "+std::to_string(overlap.left)+","+std::to_string(overlap.top));
|
||||
}
|
||||
placed.push_back({id,bounds});
|
||||
}
|
||||
RedrawWindow(lan,nullptr,nullptr,RDW_INVALIDATE|RDW_UPDATENOW|RDW_ALLCHILDREN);
|
||||
auto dc=GetDC(lan);
|
||||
auto screenshot=ks::screenshotClip(dc,client.right,client.bottom,{});
|
||||
ReleaseDC(lan,dc);
|
||||
ks::atomicWrite(std::filesystem::path(ks::executable()).parent_path()/L"lan-compact-layout.png",
|
||||
ks::encodePng(ks::decodeImage(screenshot)));
|
||||
SendMessageW(lan,WM_COMMAND,IDCANCEL,0);
|
||||
SendMessageW(app.settingsWindow,WM_COMMAND,IDCANCEL,0);
|
||||
std::cout<<"Computers layout verified at "<<dpi<<" DPI.\n";
|
||||
}
|
||||
void contextChecks()
|
||||
{
|
||||
ks::Settings scoped;
|
||||
@@ -114,12 +164,19 @@ void contextChecks()
|
||||
require(hook.update('A', true, MOD_ALT, true) == 0, "ordinary keys pass");
|
||||
}
|
||||
}
|
||||
int main()
|
||||
int main(int argc,char **argv)
|
||||
{
|
||||
CoInitializeEx(nullptr, COINIT_APARTMENTTHREADED);
|
||||
auto root = std::filesystem::temp_directory_path() / (L"KSwitcher-chat-tests-" + std::to_wstring(GetCurrentProcessId()));
|
||||
try
|
||||
{
|
||||
if(argc==2 && std::string_view(argv[1])=="--lan-layout")
|
||||
{
|
||||
lanWindowLayoutChecks(root);
|
||||
std::filesystem::remove_all(root);
|
||||
CoUninitialize();
|
||||
return 0;
|
||||
}
|
||||
contextChecks();
|
||||
{
|
||||
ks::App app(GetModuleHandleW(nullptr), true, root);
|
||||
@@ -451,7 +508,7 @@ int main()
|
||||
SendMessageW(pairedApp.settingsWindow,WM_COMMAND,262,0);
|
||||
HWND lan=findTestWindow(L"KSwitcher.LAN",nullptr);
|
||||
require(SendDlgItemMessageW(lan,702,LB_GETCURSEL,0,0)==0,"single saved pair selected automatically when opening LAN settings");
|
||||
wchar_t pairState[512]{};SendDlgItemMessageW(lan,702,LB_GETTEXT,0,(LPARAM)pairState);
|
||||
wchar_t pairState[512]{};GetDlgItemTextW(lan,710,pairState,std::size(pairState));
|
||||
require(std::wstring(pairState).find(L"Pair saved — input disabled here")!=std::wstring::npos,"saved pairing does not imply an active input connection");
|
||||
require(!IsWindowEnabled(GetDlgItem(lan,705))&&!IsWindowEnabled(GetDlgItem(lan,703))&&!IsWindowEnabled(GetDlgItem(lan,704)),"saved pair disables pairing and code controls");
|
||||
SendDlgItemMessageW(lan,702,LB_SETCURSEL,-1,0);
|
||||
|
||||
+138
-2
@@ -1,6 +1,9 @@
|
||||
param(
|
||||
[Parameter(Mandatory)][string]$Executable,
|
||||
[Parameter(Mandatory)][string]$Fixture
|
||||
[Parameter(Mandatory)][string]$Fixture,
|
||||
[switch]$SystemOpenOnly,
|
||||
[switch]$TerminalOnly,
|
||||
[string]$Node='node'
|
||||
)
|
||||
$ErrorActionPreference = 'Stop'
|
||||
Add-Type @"
|
||||
@@ -113,6 +116,11 @@ function Send-Terminal([string]$Command) {
|
||||
Press-Enter $inputBox
|
||||
}
|
||||
|
||||
function Send-InteractiveTerminal([string]$Command, [string]$EnterKey = '{ENTER}') {
|
||||
[void][FilesActivationUi]::Write($inputBox, 0x0C, [IntPtr]::Zero, $Command)
|
||||
$keys.SendKeys($EnterKey)
|
||||
}
|
||||
|
||||
function Assert-Open($List, $Target, [bool]$DoubleClick) {
|
||||
$report = "$Target.opened"
|
||||
Remove-Item -LiteralPath $report -ErrorAction SilentlyContinue
|
||||
@@ -133,6 +141,8 @@ $profileValues = 'LeftPath', 'RightPath', 'LeftCursor', 'RightCursor', 'LeftWide
|
||||
'ShowDetails', 'StatusFields', 'CommandHistory', 'WindowPlacement'
|
||||
$process = $null
|
||||
$trace = $null
|
||||
$webviewFlags=$env:WEBVIEW2_ADDITIONAL_BROWSER_ARGUMENTS
|
||||
$webviewProfile=$env:WEBVIEW2_USER_DATA_FOLDER
|
||||
try {
|
||||
foreach ($name in $profileValues) {
|
||||
if ($name -in $profile.GetValueNames()) {
|
||||
@@ -149,7 +159,7 @@ try {
|
||||
Copy-Item -LiteralPath "$source\WebView2Loader.dll", "$source\terminal" -Destination $app -Recurse
|
||||
$program = Join-Path $leftDir 'Test program.exe'
|
||||
Copy-Item -LiteralPath $Fixture -Destination $program
|
||||
$document = Join-Path $rightDir "Test document$extension"
|
||||
$document = Join-Path $(if($SystemOpenOnly -or $TerminalOnly){$leftDir}else{$rightDir}) "Test document$extension"
|
||||
[IO.File]::WriteAllText($document, 'Document fixture')
|
||||
$association = $classes.CreateSubKey($extension)
|
||||
$association.SetValue('', $progId)
|
||||
@@ -169,6 +179,14 @@ try {
|
||||
foreach ($name in 'LeftWide', 'RightWide', 'ShowDetails') { $profile.SetValue($name, 1) }
|
||||
$profile.SetValue('StatusFields', 3)
|
||||
|
||||
if($TerminalOnly){
|
||||
$listener=[Net.Sockets.TcpListener]::new([Net.IPAddress]::Loopback,0)
|
||||
$listener.Start()
|
||||
$port=$listener.LocalEndpoint.Port
|
||||
$listener.Stop()
|
||||
$env:WEBVIEW2_ADDITIONAL_BROWSER_ARGUMENTS="--remote-debugging-port=$port"
|
||||
$env:WEBVIEW2_USER_DATA_FOLDER=Join-Path $root 'webview'
|
||||
}
|
||||
$process = Start-Process -FilePath $testExe -ArgumentList '--terminal-output-trace' -PassThru
|
||||
$trace = Join-Path ([IO.Path]::GetTempPath()) "KSwitcher.Files.terminal-trace-$($process.Id).log"
|
||||
Wait-Until 'Files window' { $process.Refresh(); $process.MainWindowHandle -ne [IntPtr]::Zero }
|
||||
@@ -179,6 +197,114 @@ try {
|
||||
$output = [FilesActivationUi]::GetDlgItem($window, 145)
|
||||
$inputBox = [FilesActivationUi]::FindWindowEx($window, [IntPtr]::Zero, 'Edit', $null)
|
||||
|
||||
if($SystemOpenOnly) {
|
||||
$keys = New-Object -ComObject WScript.Shell
|
||||
$explorer = New-Object -ComObject Shell.Application
|
||||
$existingExplorerWindows = @($explorer.Windows() | ForEach-Object { $_.HWND })
|
||||
Wait-Until 'Files ready for Shift+Enter' {
|
||||
[FilesActivationUi]::Activate($window) -and [FilesActivationUi]::Focus($window) -eq $inputBox
|
||||
}
|
||||
$folderRow=Find-Row $left '[Test folder]'
|
||||
if($folderRow -lt 0){throw 'The folder fixture is missing.'}
|
||||
[void][FilesActivationUi]::Send($left,0x186,[IntPtr]$folderRow,[IntPtr]::Zero)
|
||||
$keys.SendKeys('+{ENTER}')
|
||||
$folderWindow = $null
|
||||
Wait-Until 'Shift+Enter opening the selected folder in Explorer' {
|
||||
$script:folderWindow = $explorer.Windows() | Where-Object {
|
||||
$_.Document.Folder.Self.Path -eq "$leftDir\Test folder"
|
||||
} | Select-Object -First 1
|
||||
$null -ne $script:folderWindow
|
||||
}
|
||||
if($folderWindow.HWND -notin $existingExplorerWindows){$folderWindow.Quit()}
|
||||
if((Read-Text ([FilesActivationUi]::GetDlgItem($window,142))) -ne $leftDir){
|
||||
throw 'Shift+Enter changed the folder in the Files panel.'
|
||||
}
|
||||
Wait-Until 'Files active for the registered document test' { [FilesActivationUi]::Activate($window) }
|
||||
$documentRow=Find-Row $left ([IO.Path]::GetFileName($document))
|
||||
if($documentRow -lt 0){throw 'The document fixture is missing.'}
|
||||
[void][FilesActivationUi]::Send($left,0x186,[IntPtr]$documentRow,[IntPtr]::Zero)
|
||||
Wait-Until 'Files command line focused for document Shift+Enter' {
|
||||
[FilesActivationUi]::Focus($window) -eq $inputBox
|
||||
}
|
||||
$keys.SendKeys('+{ENTER}')
|
||||
Wait-Until 'Shift+Enter invoking the default Windows file association' {
|
||||
(Test-Path -LiteralPath "$document.opened") -and [IO.File]::ReadAllText("$document.opened") -eq 'opened'
|
||||
}
|
||||
Wait-Until 'Files active for plain Enter' { [FilesActivationUi]::Activate($window) }
|
||||
[void][FilesActivationUi]::Write($inputBox,0x0C,[IntPtr]::Zero,'')
|
||||
Remove-Item -LiteralPath "$document.opened"
|
||||
$keys.SendKeys('{ENTER}')
|
||||
Wait-Until 'plain Enter invoking the default Windows file association' {
|
||||
(Test-Path -LiteralPath "$document.opened") -and [IO.File]::ReadAllText("$document.opened") -eq 'opened'
|
||||
}
|
||||
Write-Output 'Verified Shift+Enter opens folders in Explorer. Both Enter and Shift+Enter invoke the default file action.'
|
||||
Remove-Item -LiteralPath "$document.opened"
|
||||
}
|
||||
if($SystemOpenOnly -or $TerminalOnly){
|
||||
$keys = New-Object -ComObject WScript.Shell
|
||||
foreach($case in @(
|
||||
@{Name='enter-panes'; Keys='{ENTER}'},
|
||||
@{Name='shift-enter-panes'; Keys='+{ENTER}'},
|
||||
@{Name='enter-terminal'; Keys='{ENTER}'; HidePanes=$true},
|
||||
@{Name='shift-enter-terminal'; Keys='+{ENTER}'}
|
||||
)) {
|
||||
Wait-Until 'Files command line active' {
|
||||
[FilesActivationUi]::Activate($window) -and [FilesActivationUi]::Focus($window) -eq $inputBox
|
||||
}
|
||||
if($case.HidePanes){
|
||||
$keys.SendKeys('^o')
|
||||
Wait-Until 'file panes hidden' { ![FilesActivationUi]::IsWindowVisible($left) }
|
||||
}
|
||||
$marker=Join-Path $root "$($case.Name).txt"
|
||||
$command="[IO.File]::AppendAllText('$($marker.Replace("'","''"))','executed')"
|
||||
Send-InteractiveTerminal $command $case.Keys
|
||||
Wait-Until "$($case.Name) running the command" {
|
||||
(Test-Path -LiteralPath $marker) -and [IO.File]::ReadAllText($marker) -ceq 'executed' -and
|
||||
!(Read-Text $inputBox)
|
||||
}
|
||||
if(Test-Path -LiteralPath "$document.opened"){
|
||||
throw "$($case.Name) did not give the command line priority."
|
||||
}
|
||||
}
|
||||
Write-Output 'Verified command-line priority for Enter and Shift+Enter with panels visible and hidden.'
|
||||
if(!$TerminalOnly){return}
|
||||
foreach($name in 'zzzz-dir-first','zzzz-dir-second'){
|
||||
[IO.File]::WriteAllText((Join-Path $leftDir $name),'dir marker')
|
||||
Send-InteractiveTerminal 'dir'
|
||||
Wait-Until "dir rendering $name in terminal output" {
|
||||
!(Read-Text $inputBox) -and
|
||||
(Select-String -LiteralPath $trace -SimpleMatch $name -Quiet -ErrorAction SilentlyContinue)
|
||||
}
|
||||
}
|
||||
$keys.SendKeys('^o')
|
||||
Wait-Until 'file panes visible again' { [FilesActivationUi]::IsWindowVisible($left) }
|
||||
$listing=Join-Path $root 'dir-visible.txt'
|
||||
Send-InteractiveTerminal "dir -Name | Set-Content -LiteralPath '$($listing.Replace("'","''"))'"
|
||||
Wait-Until 'dir running after restoring the file panes' {
|
||||
!(Read-Text $inputBox) -and (Test-Path -LiteralPath $listing) -and
|
||||
([IO.File]::ReadAllLines($listing) -ccontains 'zzzz-dir-second')
|
||||
}
|
||||
Write-Output 'Verified repeated dir commands in the same terminal with file panes hidden and visible.'
|
||||
$marker=Join-Path $root 'webview-enter.txt'
|
||||
$command="[IO.File]::AppendAllText('$($marker.Replace("'","''"))','executed')"
|
||||
[void][FilesActivationUi]::Write($inputBox,0x0C,[IntPtr]::Zero,$command)
|
||||
& $Node (Join-Path $PSScriptRoot 'files_markdown_browser.mjs') $port 'terminal-enter'
|
||||
if($LASTEXITCODE){throw 'Could not send Enter through the terminal WebView.'}
|
||||
Wait-Until 'the terminal WebView forwarding Enter to the command line' {
|
||||
(Test-Path -LiteralPath $marker) -and [IO.File]::ReadAllText($marker) -ceq 'executed' -and
|
||||
!(Read-Text $inputBox)
|
||||
}
|
||||
Write-Output 'Verified Enter from the terminal WebView runs the command exactly once.'
|
||||
Select-Row $left '[Test folder]'
|
||||
& $Node (Join-Path $PSScriptRoot 'files_markdown_browser.mjs') $port 'terminal-enter'
|
||||
if($LASTEXITCODE){throw 'Could not send Enter through the terminal WebView.'}
|
||||
Wait-Until 'Enter from the terminal opening the selected folder in the pane' {
|
||||
(Read-Text ([FilesActivationUi]::GetDlgItem($window,142))) -eq "$leftDir\Test folder"
|
||||
}
|
||||
Write-Output 'Verified Enter from the terminal opens the selected folder with an empty command line.'
|
||||
return
|
||||
}
|
||||
|
||||
Select-Row $left '..'
|
||||
[void][FilesActivationUi]::Send($right, 0x186, [IntPtr]::Zero, [IntPtr]::Zero)
|
||||
[void][FilesActivationUi]::Write($inputBox, 0x0C, [IntPtr]::Zero, 'draft command')
|
||||
@@ -343,7 +469,17 @@ try {
|
||||
(Find-Row $right '[Size B]')
|
||||
}
|
||||
Write-Output 'Ctrl+R refreshed the active pane and kept its cursor.'
|
||||
} catch {
|
||||
if ($inputBox -and $status) {
|
||||
Write-Output "Command input length: $((Read-Text $inputBox).Length). Status: $(Read-Text $status)"
|
||||
}
|
||||
if ($trace -and (Test-Path -LiteralPath $trace)) {
|
||||
Get-Content -LiteralPath $trace -Tail 25
|
||||
}
|
||||
throw
|
||||
} finally {
|
||||
$env:WEBVIEW2_ADDITIONAL_BROWSER_ARGUMENTS=$webviewFlags
|
||||
$env:WEBVIEW2_USER_DATA_FOLDER=$webviewProfile
|
||||
if ($process -and !$process.HasExited) {
|
||||
[void]$process.CloseMainWindow()
|
||||
if (!$process.WaitForExit(4000)) { $process.Kill(); $process.WaitForExit() }
|
||||
|
||||
@@ -41,9 +41,12 @@ async function evaluate(expression) {
|
||||
const target = await waitFor(async () => {
|
||||
const response = await fetch('http://127.0.0.1:' + port + '/json/list').catch(() => null);
|
||||
if (!response?.ok) return;
|
||||
return (await response.json()).find(item => item.url === 'https://kswitcher-markdown.invalid/markdown.html' &&
|
||||
const url = scenario === 'terminal-enter'
|
||||
? 'https://kswitcher-terminal.invalid/index.html'
|
||||
: 'https://kswitcher-markdown.invalid/markdown.html';
|
||||
return (await response.json()).find(item => item.url === url &&
|
||||
(!title || item.title === title));
|
||||
}, 'the Markdown page in WebView2');
|
||||
}, 'the target WebView2 page');
|
||||
socket = new WebSocket(target.webSocketDebuggerUrl);
|
||||
socket.addEventListener('message', event => {
|
||||
const reply = JSON.parse(event.data);
|
||||
@@ -59,7 +62,11 @@ await new Promise((resolve, reject) => {
|
||||
});
|
||||
|
||||
try {
|
||||
if (scenario === 'render') {
|
||||
if (scenario === 'terminal-enter') {
|
||||
await evaluate('document.querySelector(".xterm-helper-textarea").focus()');
|
||||
await command('Input.dispatchKeyEvent', { type:'keyDown', key:'Enter', code:'Enter', windowsVirtualKeyCode:13 });
|
||||
await command('Input.dispatchKeyEvent', { type:'keyUp', key:'Enter', code:'Enter', windowsVirtualKeyCode:13 });
|
||||
} else if (scenario === 'render') {
|
||||
await waitFor(() => evaluate(`document.documentElement?.classList.contains('rendered') &&
|
||||
!!document.querySelector('figure svg') &&
|
||||
document.querySelector('img')?.naturalWidth === 1`), 'rendered Mermaid SVG and relative image');
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
param([Parameter(Mandatory)][string]$Executable)
|
||||
param([Parameter(Mandatory)][string]$Executable,[switch]$KeyboardCursorOnly)
|
||||
$ErrorActionPreference='Stop'
|
||||
Add-Type -AssemblyName System.Drawing
|
||||
Add-Type @"
|
||||
@@ -10,6 +10,7 @@ public static class SearchArrowTest {
|
||||
[DllImport("user32.dll")] public static extern uint GetWindowThreadProcessId(IntPtr window, out uint pid);
|
||||
[DllImport("user32.dll")] public static extern IntPtr GetDlgItem(IntPtr hwnd, int id);
|
||||
[DllImport("user32.dll", EntryPoint="SendMessageW")] public static extern IntPtr Send(IntPtr hwnd, uint message, IntPtr w, IntPtr l);
|
||||
[DllImport("user32.dll", EntryPoint="SendMessageW")] public static extern IntPtr SendRect(IntPtr hwnd, uint message, IntPtr w, out Rect rect);
|
||||
[DllImport("user32.dll", EntryPoint="SendMessageW", CharSet=CharSet.Unicode)] public static extern IntPtr SendText(IntPtr hwnd, uint message, IntPtr w, string l);
|
||||
[DllImport("user32.dll", EntryPoint="SendMessageW", CharSet=CharSet.Unicode)] public static extern IntPtr GetText(IntPtr hwnd, uint message, IntPtr w, StringBuilder l);
|
||||
[DllImport("user32.dll")] public static extern bool PostMessage(IntPtr hwnd, uint message, IntPtr w, IntPtr l);
|
||||
@@ -94,6 +95,23 @@ function Select-Row($Panel, $Name) {
|
||||
function Post($Window, $Message, $W, $L = 0) {
|
||||
if (![SearchArrowTest]::PostMessage($Window, $Message, $W, $L)) { throw "Post failed" }
|
||||
}
|
||||
function Click-PanelRow($Panel, $Row) {
|
||||
$bounds=[SearchArrowTest+Rect]::new()
|
||||
if([SearchArrowTest]::SendRect($Panel,0x198,$Row,[ref]$bounds).ToInt64() -eq -1){
|
||||
throw "Missing file panel row $Row"
|
||||
}
|
||||
$point=([int](($bounds.Top+$bounds.Bottom)/2) -shl 16) -bor 6
|
||||
Post $Panel 0x201 1 $point
|
||||
Post $Panel 0x202 0 $point
|
||||
}
|
||||
function Read-PanelHighlights($Trace, $Start) {
|
||||
$highlight=@{}
|
||||
Get-Content -LiteralPath $Trace | Select-Object -Skip $Start |
|
||||
ForEach-Object { if($_ -match '^\d+ panel-draw ([01]) (\d+) ([01]) '){
|
||||
$highlight["$($Matches[1])/$($Matches[2])"]=$Matches[3]
|
||||
} }
|
||||
return $highlight
|
||||
}
|
||||
function Assert-FarCheckbox($Dialog, [int]$Id, $NextControl) {
|
||||
$checkbox=[SearchArrowTest]::GetDlgItem($Dialog,$Id)
|
||||
Post $Dialog 0x28 $checkbox 1
|
||||
@@ -213,12 +231,61 @@ $scratch=Join-Path ([IO.Path]::GetDirectoryName((Resolve-Path -LiteralPath $Exec
|
||||
New-Item -ItemType Directory -Path $scratch | Out-Null
|
||||
$fixture = Join-Path $scratch ('files-editor-ui-' + [Guid]::NewGuid().ToString('N') + '.cs')
|
||||
[IO.File]::WriteAllText($fixture, "public class Test {`r`n}`r`n")
|
||||
foreach($name in 'A.txt','B.txt','C.txt','D.txt'){
|
||||
[IO.File]::WriteAllText((Join-Path $scratch $name),'Cursor test fixture')
|
||||
}
|
||||
$rightFixture=Join-Path $scratch 'Right fixture'
|
||||
New-Item -ItemType Directory -Path $rightFixture | Out-Null
|
||||
foreach($name in 'A.txt','B.txt','C.txt','D.txt'){
|
||||
[IO.File]::WriteAllText((Join-Path $rightFixture $name),'Cursor test fixture')
|
||||
}
|
||||
$copy=Join-Path $scratch 'KSwitcher.Files.search-arrow-test.exe'
|
||||
Copy-Item -LiteralPath $Executable -Destination $copy
|
||||
$process = Start-Process -FilePath $copy -PassThru -WindowStyle Hidden
|
||||
$profile=[Microsoft.Win32.Registry]::CurrentUser.CreateSubKey('Software\KSwitcher\Files')
|
||||
$keysToRestore='LeftPath','RightPath','LeftCursor','RightCursor','WindowPlacement'
|
||||
$saved=@{}
|
||||
foreach($name in $keysToRestore){
|
||||
if($name -in $profile.GetValueNames()){
|
||||
$saved[$name]=@($profile.GetValue($name),$profile.GetValueKind($name))
|
||||
}
|
||||
}
|
||||
$process=$null
|
||||
$paintTrace=$null
|
||||
try {
|
||||
$profile.SetValue('LeftPath',$scratch)
|
||||
$profile.SetValue('RightPath',$rightFixture)
|
||||
$profile.DeleteValue('LeftCursor',$false)
|
||||
$profile.DeleteValue('RightCursor',$false)
|
||||
$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))
|
||||
$main = Wait-Until { Find-Window 'KSwitcher.Files' $process.Id }
|
||||
$leftPanel=[SearchArrowTest]::GetDlgItem($main,102)
|
||||
$rightPanel=[SearchArrowTest]::GetDlgItem($main,103)
|
||||
$clicks=if(!$KeyboardCursorOnly){
|
||||
@(@{Panel=$leftPanel; Index=0},@{Panel=$rightPanel; Index=1},@{Panel=$rightPanel; Index=1})
|
||||
}
|
||||
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}
|
||||
[void](Wait-Until { Test-Path -LiteralPath $paintTrace })
|
||||
Start-Sleep -Milliseconds 150
|
||||
$lineCount=@(Get-Content -LiteralPath $paintTrace).Count
|
||||
Click-PanelRow $check.Panel $row
|
||||
[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["$($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($clicks){Write-Output 'Verified file clicks repaint only cursor rows in the active pane and when changing panes.'}
|
||||
Post $main 0x111 132
|
||||
$commandMenu=Wait-Until {
|
||||
$list=[SearchArrowTest]::GetDlgItem($main,121)
|
||||
@@ -268,6 +335,71 @@ try {
|
||||
Select-Row $panel "[$component]"
|
||||
[void][SearchArrowTest]::Send($panel,0x100,13,0)
|
||||
}
|
||||
$fixtureRow=[SearchArrowTest]::SendText($panel,0x1A2,-1,([IO.Path]::GetFileName($fixture))).ToInt32()
|
||||
Click-PanelRow $panel $fixtureRow
|
||||
[void](Wait-Until { [SearchArrowTest]::Send($panel,0x188,0,0).ToInt32() -eq $fixtureRow })
|
||||
$inputBox=[SearchArrowTest]::FindWindowEx($main,0,'Edit',[NullString]::Value)
|
||||
[void](Wait-Until { [SearchArrowTest]::FocusedControl($main) -eq $inputBox })
|
||||
[void][SearchArrowTest]::SendText($inputBox,0xC,0,'')
|
||||
$last=[SearchArrowTest]::Send($panel,0x18B,0,0).ToInt32()-1
|
||||
$keys=@(
|
||||
@{Name='Left'; Code=37; Row=0}
|
||||
@{Name='Right'; Code=39; Row=$last}
|
||||
@{Name='Left'; Code=37; Row=0}
|
||||
@{Name='Down'; Code=40; Row=1}
|
||||
@{Name='Up'; Code=38; Row=0}
|
||||
@{Name='End'; Code=35; Row=$last}
|
||||
@{Name='Home'; Code=36; Row=0}
|
||||
@{Name='Page Down'; Code=34; Row=$last}
|
||||
@{Name='Page Up'; Code=33; Row=0}
|
||||
)
|
||||
foreach($key in $keys){
|
||||
$previous=[SearchArrowTest]::Send($panel,0x188,0,0).ToInt32()
|
||||
Start-Sleep -Milliseconds 100
|
||||
$lineCount=@(Get-Content -LiteralPath $paintTrace).Count
|
||||
Post $inputBox 0x100 $key.Code
|
||||
try {
|
||||
[void](Wait-Until { [SearchArrowTest]::Send($panel,0x188,0,0).ToInt32() -eq $key.Row })
|
||||
} catch {
|
||||
$actual=[SearchArrowTest]::Send($panel,0x188,0,0).ToInt32()
|
||||
throw "$($key.Name) selected row $actual, expected row $($key.Row)."
|
||||
}
|
||||
Start-Sleep -Milliseconds 150
|
||||
$highlight=Read-PanelHighlights $paintTrace $lineCount
|
||||
if($highlight["0/$($key.Row)"] -ne '1' -or $highlight["0/$previous"] -ne '0'){
|
||||
throw "$($key.Name) left the previous row highlighted or did not paint the new row active."
|
||||
}
|
||||
}
|
||||
Write-Output 'Verified cursor highlighting after arrows, Home, End, Page Up and Page Down from the command line.'
|
||||
if($KeyboardCursorOnly){return}
|
||||
Click-PanelRow $panel $fixtureRow
|
||||
$deleteButton=[SearchArrowTest]::GetDlgItem($main,117)
|
||||
$deleteLabel=[Text.StringBuilder]::new(64)
|
||||
[void][SearchArrowTest]::GetText($deleteButton,0xD,$deleteLabel.Capacity,$deleteLabel)
|
||||
if($deleteLabel.ToString() -cne 'F8 Delete'){throw 'The F8 Delete key bar button is missing.'}
|
||||
$bounds=Read-Bounds $deleteButton
|
||||
$windowBounds=Read-Bounds $main
|
||||
$bitmap=[Drawing.Bitmap]::new($windowBounds.Right-$windowBounds.Left,$windowBounds.Bottom-$windowBounds.Top)
|
||||
try {
|
||||
$graphics=[Drawing.Graphics]::FromImage($bitmap)
|
||||
try {
|
||||
$dc=$graphics.GetHdc()
|
||||
try { if(![SearchArrowTest]::PrintWindow($main,$dc,0)){throw 'Could not render the Files window.'} }
|
||||
finally { $graphics.ReleaseHdc($dc) }
|
||||
} finally {$graphics.Dispose()}
|
||||
$y=$bounds.Top-$windowBounds.Top+1
|
||||
$cap=$bitmap.GetPixel(($bounds.Left-$windowBounds.Left+1),$y)
|
||||
$action=$bitmap.GetPixel(($bounds.Right-$windowBounds.Left-2),$y)
|
||||
if($cap.ToArgb() -ne [Drawing.Color]::Black.ToArgb() -or $action.ToArgb() -eq $cap.ToArgb()){
|
||||
throw 'The key bar no longer separates its dark key cap from the action segment.'
|
||||
}
|
||||
} finally {$bitmap.Dispose()}
|
||||
Post $deleteButton 0xF5 0
|
||||
$deleteDialog=Wait-Until { Find-Window '#32770' $process.Id 6 }
|
||||
Post $deleteDialog 0x111 2
|
||||
[void](Wait-Until { ![SearchArrowTest]::IsWindow($deleteDialog) })
|
||||
if(!(Test-Path -LiteralPath $fixture)){throw 'Canceling F8 Delete removed the fixture.'}
|
||||
Write-Output 'Verified F8 Delete on the key bar opens the normal confirmation.'
|
||||
$newFolder='F7 тестова папка'
|
||||
Post $panel 0x100 0x76
|
||||
$makeDialog=Wait-Until { Find-Window '#32770' $process.Id 361 }
|
||||
@@ -687,11 +819,17 @@ try {
|
||||
if (!$process.WaitForExit(5000)) { throw 'Files did not exit after its last window closed.' }
|
||||
}
|
||||
finally {
|
||||
if (!$process.HasExited) {
|
||||
if ($process -and !$process.HasExited) {
|
||||
Stop-Process -Id $process.Id
|
||||
[void]$process.WaitForExit(5000)
|
||||
}
|
||||
if ($previousDpi) { [void][SearchArrowTest]::SetThreadDpiAwarenessContext($previousDpi) }
|
||||
if($paintTrace -and (Test-Path -LiteralPath $paintTrace)){Remove-Item -LiteralPath $paintTrace -Force}
|
||||
foreach($name in $keysToRestore){
|
||||
if($saved.ContainsKey($name)){$profile.SetValue($name,$saved[$name][0],$saved[$name][1])}
|
||||
else{$profile.DeleteValue($name,$false)}
|
||||
}
|
||||
$profile.Dispose()
|
||||
$resolved=(Resolve-Path -LiteralPath $scratch).Path
|
||||
$root=(Resolve-Path -LiteralPath (Split-Path -Parent $scratch)).Path
|
||||
if ([IO.Path]::GetDirectoryName($resolved) -eq $root -and (Split-Path -Leaf $resolved) -like 'search-arrow-test-*') {
|
||||
|
||||
@@ -216,6 +216,16 @@ int main()
|
||||
[&](std::string_view part){console+=part;});
|
||||
require(directoryExit==0 && console.find("CLIXML")==console.npos &&
|
||||
console.find("Hidden progress probe")==console.npos,"remote directory command included progress metadata");
|
||||
for(const auto marker:{L"dir-first-marker.txt",L"dir-second-marker.txt"})
|
||||
{
|
||||
save(root/marker,"remote directory fixture");
|
||||
FilesConnection separateCommand(one,client,key);
|
||||
console.clear();
|
||||
const auto code=runRemoteCommand(separateCommand,root,L"dir",
|
||||
[&](std::string_view part){console+=part;});
|
||||
require(code==0 && console.find(utf8(marker))!=console.npos,
|
||||
"successive remote dir commands must list the current files and exit");
|
||||
}
|
||||
std::stop_source cancel;
|
||||
try
|
||||
{
|
||||
|
||||
Reference in new issue
Block a user