Compare commits
3
Commits
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
3c5f59ed91 | ||
|
|
e50fbbc119 | ||
|
|
6c5b09132f |
No files matched your search
+7
-1
@@ -1,5 +1,5 @@
|
||||
cmake_minimum_required(VERSION 3.24)
|
||||
project(KSwitcher VERSION 0.6.99 LANGUAGES CXX RC)
|
||||
project(KSwitcher VERSION 0.6.100 LANGUAGES CXX RC)
|
||||
if(NOT WIN32)
|
||||
message(FATAL_ERROR "KSwitcher uses native Windows APIs")
|
||||
endif()
|
||||
@@ -157,6 +157,12 @@ add_test(NAME files-system-open
|
||||
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
|
||||
|
||||
@@ -47,6 +47,8 @@ Warning і початковий фокус на No.
|
||||
Enter і Shift+Enter спочатку виконують введену команду. Коли рядок
|
||||
порожній, Enter відкриває поточний елемент. Якщо панелі приховано,
|
||||
Enter передає порожній рядок у термінал. Escape очищає рядок.
|
||||
Якщо фокус у виводі термінала, Enter повертає його до командного рядка
|
||||
й запускає введену команду.
|
||||
Промпт і текст команди вирівняні по спільній базовій лінії.
|
||||
- **F8 Delete** у нижньому рядку клавіш викликає той самий діалог видалення,
|
||||
що й клавіша F8.
|
||||
|
||||
@@ -1,5 +1,11 @@
|
||||
# Latest Windows release
|
||||
|
||||
## 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.
|
||||
|
||||
@@ -1 +1 @@
|
||||
c154e3b6d8042e83965850d395b2c0e7504a0abe5cbf98e0dc7db3988a8b9900 KSwitcher-win-x64.zip
|
||||
26e2ddb65b89a1b3c089ebf5958bb2ceb1ee5ce2d3a63b87d2c7d1e0707a83e6 KSwitcher-win-x64.zip
|
||||
+43
-43
@@ -1,166 +1,166 @@
|
||||
{
|
||||
"version": "0.6.100",
|
||||
"schema": 1,
|
||||
"files": [
|
||||
{
|
||||
"sha256": "dc44f9115be52e8642c349ffc737e00e57a6d758e918da6426bac9256720b0bf",
|
||||
"size": 2361856,
|
||||
"sha256": "0893ab73daea7943c7a88d1161a0f318b2fb53588d677d63938573da6a1d3457",
|
||||
"path": "KSwitcher.exe"
|
||||
},
|
||||
{
|
||||
"sha256": "4cd23521c58a85381819886cd42e8fbbca1941152247a7e199763676447777cf",
|
||||
"size": 2359808,
|
||||
"sha256": "41941a2bcdc19abea8e9d87e77313e9f02b91a6ab7c01c5ffd043c21d1fe164f",
|
||||
"path": "KSwitcher.Config.exe"
|
||||
},
|
||||
{
|
||||
"sha256": "ed3ccea0262caf8fef7c1f0098d7646f7e6239f9c44f3ae538ed819272bcdd7d",
|
||||
"size": 3337216,
|
||||
"sha256": "e25fcd6adee313985fa9530c9f4a0d26b7c17ffacd66a72ce1966f57e10e8139",
|
||||
"path": "KSwitcher.Screenshot.exe"
|
||||
},
|
||||
{
|
||||
"sha256": "abde48d42d1bd4a5968a682a688fab201bd16fcb21d11271c88dc3c0a349ad43",
|
||||
"size": 3738112,
|
||||
"size": 3739136,
|
||||
"sha256": "34cd98beeda97820309b3fa2d7e948c62de2bd3180963726a23e4ce9728de586",
|
||||
"path": "KSwitcher.Files.exe"
|
||||
},
|
||||
{
|
||||
"sha256": "d3fce90bdeecb08596e377dea6a316354dd8949e32ff09b89d51be00c14e21b6",
|
||||
"size": 194912,
|
||||
"sha256": "d3fce90bdeecb08596e377dea6a316354dd8949e32ff09b89d51be00c14e21b6",
|
||||
"path": "WebView2Loader.dll"
|
||||
},
|
||||
{
|
||||
"sha256": "e256f01188af527e4d06d21d06fbf785ae9c50d4b328bf03cbe0ba7f0aa4228f",
|
||||
"size": 1103,
|
||||
"sha256": "e256f01188af527e4d06d21d06fbf785ae9c50d4b328bf03cbe0ba7f0aa4228f",
|
||||
"path": "terminal/addon-fit-LICENSE.txt"
|
||||
},
|
||||
{
|
||||
"sha256": "ba3ea256ce0620a0992a197d6c9baea64823fc93d8da07a9e366ca9943c18527",
|
||||
"size": 1521,
|
||||
"sha256": "ba3ea256ce0620a0992a197d6c9baea64823fc93d8da07a9e366ca9943c18527",
|
||||
"path": "terminal/addon-fit.js"
|
||||
},
|
||||
{
|
||||
"sha256": "084d97a727b778fb10d31adcd557ee7840a38377ed60e0ef0f3ece93b349b1ef",
|
||||
"size": 527,
|
||||
"sha256": "084d97a727b778fb10d31adcd557ee7840a38377ed60e0ef0f3ece93b349b1ef",
|
||||
"path": "terminal/index.html"
|
||||
},
|
||||
{
|
||||
"sha256": "792c48c5a849a15fdf9e37e8bcf9e6d1dd13b32b46c642a748a0a46a9919d473",
|
||||
"size": 1073,
|
||||
"sha256": "792c48c5a849a15fdf9e37e8bcf9e6d1dd13b32b46c642a748a0a46a9919d473",
|
||||
"path": "terminal/markdown-it-LICENSE.txt"
|
||||
},
|
||||
{
|
||||
"sha256": "391f2aa638e75e6c7859d0a5c5650ef0956722a45998f17e05b83bc655778e1e",
|
||||
"size": 100786,
|
||||
"sha256": "391f2aa638e75e6c7859d0a5c5650ef0956722a45998f17e05b83bc655778e1e",
|
||||
"path": "terminal/markdown-it.js"
|
||||
},
|
||||
{
|
||||
"sha256": "27d3c6d39325d4995162911c352a8e20603513445683ceb0409e628949c39237",
|
||||
"size": 2212,
|
||||
"size": 2171,
|
||||
"sha256": "b011e0872c869c48302a37b3e2e462addc1ee11e723f840ad7df1e893fc15336",
|
||||
"path": "terminal/markdown.html"
|
||||
},
|
||||
{
|
||||
"sha256": "dbf9a062364dcc90b59fd98eb0adb0f153ed95accf26e28f7be9cce8c13ae324",
|
||||
"size": 6534,
|
||||
"size": 6381,
|
||||
"sha256": "21cc15ceb2b8bee9b3f6a816d629677dab61243daf784c10b4c96312729cb149",
|
||||
"path": "terminal/markdown.js"
|
||||
},
|
||||
{
|
||||
"sha256": "ec9fb67dcb25eccc416ed56e1aab819222c805a2a4bfe4cb19e7556bf2ffde80",
|
||||
"size": 1089,
|
||||
"sha256": "ec9fb67dcb25eccc416ed56e1aab819222c805a2a4bfe4cb19e7556bf2ffde80",
|
||||
"path": "terminal/mermaid-LICENSE.txt"
|
||||
},
|
||||
{
|
||||
"sha256": "336df803d87a38b70a01e736e666c8f7601d2ce42f5e47c8fafe5d721074b9a3",
|
||||
"size": 5537838,
|
||||
"sha256": "336df803d87a38b70a01e736e666c8f7601d2ce42f5e47c8fafe5d721074b9a3",
|
||||
"path": "terminal/mermaid.js"
|
||||
},
|
||||
{
|
||||
"sha256": "0f3edde02b30e7b0f76d0cc88daae5791d720a4b74cf8b34e7c0b4dbe0cf9c9d",
|
||||
"size": 4478,
|
||||
"size": 4811,
|
||||
"sha256": "fc2da8549b97817d283713f0efc4f7bf668f8f2f4490f7b291ed2b01a19336e0",
|
||||
"path": "terminal/terminal.js"
|
||||
},
|
||||
{
|
||||
"sha256": "b569f629d00f2626a8100df2a1798210535621e42164dfd426a6fe5aac7b0ccd",
|
||||
"size": 1261,
|
||||
"sha256": "b569f629d00f2626a8100df2a1798210535621e42164dfd426a6fe5aac7b0ccd",
|
||||
"path": "terminal/xterm-LICENSE.txt"
|
||||
},
|
||||
{
|
||||
"sha256": "854a7c0fb70e8b1a083c16797ab827299fb18744f5ad34f227b48337e33293c6",
|
||||
"size": 7112,
|
||||
"sha256": "854a7c0fb70e8b1a083c16797ab827299fb18744f5ad34f227b48337e33293c6",
|
||||
"path": "terminal/xterm.css"
|
||||
},
|
||||
{
|
||||
"sha256": "14903579ff54664cd72f8e8699e6961a6272c21863ec1c3b118cdc8af5d4a972",
|
||||
"size": 488663,
|
||||
"sha256": "14903579ff54664cd72f8e8699e6961a6272c21863ec1c3b118cdc8af5d4a972",
|
||||
"path": "terminal/xterm.js"
|
||||
},
|
||||
{
|
||||
"sha256": "d3c81140cce01c26bf6cbf52aa40e0825e1fa35b9a91d1387170a65d2597082c",
|
||||
"size": 4401,
|
||||
"sha256": "d3c81140cce01c26bf6cbf52aa40e0825e1fa35b9a91d1387170a65d2597082c",
|
||||
"path": "LICENSE"
|
||||
},
|
||||
{
|
||||
"sha256": "61e08da79c44061654015ce6b0c4061c23ee1dd18237fbf09e9bfda3c0ea2831",
|
||||
"size": 1096,
|
||||
"size": 1075,
|
||||
"sha256": "c0d068392ea65358b798b8c165103560f06e9e3b38c4ab4e2d8810a7b931af86",
|
||||
"path": "json-LICENSE.txt"
|
||||
},
|
||||
{
|
||||
"sha256": "185c5a37521316e940ead89cbf0b1ba5862d810c7c966e6c6a14a4a515b23625",
|
||||
"size": 883,
|
||||
"sha256": "185c5a37521316e940ead89cbf0b1ba5862d810c7c966e6c6a14a4a515b23625",
|
||||
"path": "files-text-license.txt"
|
||||
},
|
||||
{
|
||||
"sha256": "fca41227e9b38bf061298d69806ea66fb00086ae03aec49665e4f68ed2c3f8e9",
|
||||
"size": 94357,
|
||||
"sha256": "fca41227e9b38bf061298d69806ea66fb00086ae03aec49665e4f68ed2c3f8e9",
|
||||
"path": "README.md"
|
||||
},
|
||||
{
|
||||
"sha256": "2c13d3ed4761e679c352fb1ade24a1ec3060ad2862376ede801cdee5fcc3bada",
|
||||
"size": 11418,
|
||||
"sha256": "2c13d3ed4761e679c352fb1ade24a1ec3060ad2862376ede801cdee5fcc3bada",
|
||||
"path": "LAN-PREVIEW.md"
|
||||
},
|
||||
{
|
||||
"sha256": "d0c022b27b9fbc2ff7b6b8bec723cc1adc4eef517202f9ff77eed5d8bea3acb9",
|
||||
"size": 732485,
|
||||
"size": 682867,
|
||||
"sha256": "5f267c141c3d6837870e1c098f86b89a113ba300343119432644ead88f720c21",
|
||||
"path": "dictionaries/en.txt"
|
||||
},
|
||||
{
|
||||
"sha256": "0bdfb0201d1803634f268cdff0993b8349d2c70e956a06dbb667c8dd65254ec5",
|
||||
"size": 20566,
|
||||
"size": 20138,
|
||||
"sha256": "28a9529c7d0bb4dc51f4bf5c116a3d16ef247a052f7591466768ddf563fd1cf5",
|
||||
"path": "dictionaries/LICENSE-CC-BY-SA-4.0.txt"
|
||||
},
|
||||
{
|
||||
"sha256": "3017bf44d3be9d9dfab21bd6778aa52b7947e61acf9ce2bc86b41d6e949ac311",
|
||||
"size": 2265,
|
||||
"sha256": "3017bf44d3be9d9dfab21bd6778aa52b7947e61acf9ce2bc86b41d6e949ac311",
|
||||
"path": "dictionaries/README.md"
|
||||
},
|
||||
{
|
||||
"sha256": "80e6b6a27815973535f7facb636c597eb845dfee45cfabfc4e9b3341b9332849",
|
||||
"size": 1109134,
|
||||
"size": 1060364,
|
||||
"sha256": "9ef922c7699569304a428f6aba0fd13a21341c0d0cb9561f37ef83c41577a28b",
|
||||
"path": "dictionaries/ru.txt"
|
||||
},
|
||||
{
|
||||
"sha256": "98e5b3fe7304e37705c9e5ff48b0b399ccb16e806736d21f09921b99e5f2a408",
|
||||
"size": 1280,
|
||||
"sha256": "98e5b3fe7304e37705c9e5ff48b0b399ccb16e806736d21f09921b99e5f2a408",
|
||||
"path": "dictionaries/sources.json"
|
||||
},
|
||||
{
|
||||
"sha256": "d30e990d6ec2983c04f3644a3c61c6c668e8c542323f5931916fdd55b916eebf",
|
||||
"size": 940799,
|
||||
"sha256": "d30e990d6ec2983c04f3644a3c61c6c668e8c542323f5931916fdd55b916eebf",
|
||||
"path": "dictionaries/uk.txt"
|
||||
},
|
||||
{
|
||||
"sha256": "a34b5161a8315af037e1ec71d816bfc688f7c364141d4ee2347cf0515ef0c82a",
|
||||
"size": 993,
|
||||
"sha256": "a34b5161a8315af037e1ec71d816bfc688f7c364141d4ee2347cf0515ef0c82a",
|
||||
"path": "tools/README.txt"
|
||||
},
|
||||
{
|
||||
"sha256": "6ef5cf64708d62b7fc63c3c793cc99188a513433ff4774cae01dc014f6664376",
|
||||
"size": 134656,
|
||||
"sha256": "6ef5cf64708d62b7fc63c3c793cc99188a513433ff4774cae01dc014f6664376",
|
||||
"path": "tools/StayHere.exe"
|
||||
},
|
||||
{
|
||||
"sha256": "ba214e2aca7405e698b3ab21ceb1f41ce088edd996b3e30e4a9d58ff496f9413",
|
||||
"size": 2796,
|
||||
"sha256": "ba214e2aca7405e698b3ab21ceb1f41ce088edd996b3e30e4a9d58ff496f9413",
|
||||
"path": "tools/StayHere-README.md"
|
||||
}
|
||||
],
|
||||
"version": "0.6.99",
|
||||
"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,99,0
|
||||
PRODUCTVERSION 0,6,99,0
|
||||
FILEVERSION 0,6,100,0
|
||||
PRODUCTVERSION 0,6,100,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.99"
|
||||
VALUE "FileVersion", "0.6.100"
|
||||
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('submit-command');
|
||||
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';
|
||||
|
||||
+26
-7
@@ -935,6 +935,7 @@ void showTerminal(HWND owner,bool show)
|
||||
|
||||
void open(Panel &panel,const fs::path &directory,bool offerElevation);
|
||||
void restoreCommandFocus();
|
||||
void submitTerminalReturn(HWND owner);
|
||||
|
||||
void invalidatePanelRow(HWND list,LRESULT row)
|
||||
{
|
||||
@@ -1099,6 +1100,8 @@ bool ensureTerminalView(HWND owner)
|
||||
{
|
||||
if(GetForegroundWindow()==owner) SetFocus(terminalInput);
|
||||
}
|
||||
else if(message==L"submit-command")
|
||||
submitTerminalReturn(owner);
|
||||
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);
|
||||
@@ -1184,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)
|
||||
@@ -1245,6 +1250,7 @@ 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);
|
||||
@@ -4811,14 +4817,29 @@ 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 submitTerminalReturn(HWND owner)
|
||||
{
|
||||
if(GetForegroundWindow()!=owner || !commandLineAvailable(owner)) return;
|
||||
SetFocus(terminalInput);
|
||||
if(terminalVisible || GetWindowTextLengthW(terminalInput))
|
||||
{
|
||||
closePanelSearch();
|
||||
runCommandLine();
|
||||
}
|
||||
}
|
||||
|
||||
LRESULT CALLBACK filesWindow(HWND window, UINT message, WPARAM wp, LPARAM lp)
|
||||
{
|
||||
if(message==filesPreferencesChanged)
|
||||
@@ -5525,9 +5546,7 @@ int WINAPI wWinMain(HINSTANCE instance, HINSTANCE, PWSTR, int show)
|
||||
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) && !copyInProgress &&
|
||||
!commandHistoryWindow && !FilesModalDialog::activeFor(window) &&
|
||||
!IsWindowVisible(menuBar) && !IsWindowVisible(picker) &&
|
||||
!(GetKeyState(VK_RWIN)&0x8000) && commandLineAvailable(window) &&
|
||||
(message.hwnd==terminalInput || message.hwnd==panels[0].list || message.hwnd==panels[1].list))
|
||||
{
|
||||
if(!(message.lParam & (1LL<<30)))
|
||||
|
||||
+1
-1
@@ -2,7 +2,7 @@
|
||||
#include "platform.h"
|
||||
namespace ks
|
||||
{
|
||||
inline constexpr wchar_t AppVersion[] = L"0.6.99";
|
||||
inline constexpr wchar_t AppVersion[] = L"0.6.100";
|
||||
inline constexpr UINT UpdateMessage = WM_APP + 7;
|
||||
inline constexpr UINT UpdateCheckIntervalMs = 6 * 60 * 60 * 1000;
|
||||
inline constexpr UINT UpdateNotificationRetryMs = 5 * 60 * 1000;
|
||||
|
||||
@@ -1,7 +1,9 @@
|
||||
param(
|
||||
[Parameter(Mandatory)][string]$Executable,
|
||||
[Parameter(Mandatory)][string]$Fixture,
|
||||
[switch]$SystemOpenOnly
|
||||
[switch]$SystemOpenOnly,
|
||||
[switch]$TerminalOnly,
|
||||
[string]$Node='node'
|
||||
)
|
||||
$ErrorActionPreference = 'Stop'
|
||||
Add-Type @"
|
||||
@@ -114,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
|
||||
@@ -134,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()) {
|
||||
@@ -150,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 $(if($SystemOpenOnly){$leftDir}else{$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)
|
||||
@@ -170,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 }
|
||||
@@ -222,6 +239,9 @@ try {
|
||||
}
|
||||
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}'},
|
||||
@@ -237,16 +257,44 @@ try {
|
||||
}
|
||||
$marker=Join-Path $root "$($case.Name).txt"
|
||||
$command="[IO.File]::AppendAllText('$($marker.Replace("'","''"))','executed')"
|
||||
[void][FilesActivationUi]::Write($inputBox,0x0C,[IntPtr]::Zero,$command)
|
||||
$keys.SendKeys($case.Keys)
|
||||
Send-InteractiveTerminal $command $case.Keys
|
||||
Wait-Until "$($case.Name) running the command" {
|
||||
(Test-Path -LiteralPath $marker) -and [IO.File]::ReadAllText($marker) -ceq 'executed'
|
||||
(Test-Path -LiteralPath $marker) -and [IO.File]::ReadAllText($marker) -ceq 'executed' -and
|
||||
!(Read-Text $inputBox)
|
||||
}
|
||||
if((Read-Text $inputBox) -or (Test-Path -LiteralPath "$document.opened")){
|
||||
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.'
|
||||
return
|
||||
}
|
||||
|
||||
@@ -414,7 +462,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');
|
||||
|
||||
@@ -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