Compare commits

...
Author SHA1 Message Date
bincxz e670e298e6 fix(shortcuts): leave Ctrl+L available for terminal clearing 2026-09-18 11:45:50 +08:00
2 changed files with 30 additions and 1 deletions

No files matched your search

+29
View File
@@ -0,0 +1,29 @@
import assert from 'node:assert/strict';
import test from 'node:test';
import { DEFAULT_KEY_BINDINGS, keyStringToKeyboardEvent } from './models/keyBindings.ts';
import { checkAppShortcut } from '../application/state/useGlobalHotkeys.ts';
function shortcut(key: string, isMac = false, bindings = DEFAULT_KEY_BINDINGS) {
const event = keyStringToKeyboardEvent(key);
assert.ok(event);
return checkAppShortcut(event, bindings, isMac)?.action ?? null;
}
test('default shortcuts leave Ctrl+L available to the terminal on both schemes', () => {
assert.equal(shortcut('Ctrl + L'), null);
assert.equal(shortcut('Ctrl + L', true), null);
});
test('local terminal remains available through New Local Tab and the macOS shortcut', () => {
assert.equal(shortcut('Ctrl + T'), 'newTab');
assert.equal(shortcut('⌘ + T', true), 'newTab');
assert.equal(shortcut('⌘ + L', true), 'openLocal');
});
test('an explicitly configured Ctrl+L still opens a local terminal', () => {
const customBindings = DEFAULT_KEY_BINDINGS.map(binding => binding.id === 'open-local'
? { ...binding, pc: 'Ctrl + L' }
: binding);
assert.equal(shortcut('Ctrl + L', false, customBindings), 'openLocal');
});
+1 -1
View File
@@ -264,7 +264,7 @@ export const DEFAULT_KEY_BINDINGS: KeyBinding[] = [
// App Features
{ id: 'open-hosts', action: 'openHosts', label: 'Open Hosts Page', mac: 'Disabled', pc: 'Disabled', category: 'app' },
{ id: 'open-local', action: 'openLocal', label: 'Open Local Terminal', mac: '⌘ + L', pc: 'Ctrl + L', category: 'app' },
{ id: 'open-local', action: 'openLocal', label: 'Open Local Terminal', mac: '⌘ + L', pc: 'Disabled', category: 'app' },
{ id: 'open-sftp', action: 'openSftp', label: 'Open SFTP', mac: '⌘ + Shift + O', pc: 'Ctrl + Shift + O', category: 'app' },
{ id: 'port-forwarding', action: 'portForwarding', label: 'Open Port Forwarding', mac: '⌘ + P', pc: 'Ctrl + P', category: 'app' },
{ id: 'command-palette', action: 'commandPalette', label: 'Open Command Palette', mac: '⌘ + K', pc: 'Ctrl + K', category: 'app' },