Skip to content

Node-based terminal manager for AI coding agents — tmux-backed terminals and parallel agent sessions as draggable nodes on an infinite pan/zoom canvas. macOS, Linux, and a browser Server Edition.

fix(terminal): allow Cmd+1-9 project jump from focused terminal

Alex19032d1f1b87
diff --git a/package-lock.json b/package-lock.json
index 5d415dcc4..e4ef292b1 100644
--- a/package-lock.json
+++ b/package-lock.json
@@ -1,12 +1,12 @@
{
"name": "node-terminal",
- "version": "0.3.3",
+ "version": "0.3.4",
"lockfileVersion": 3,
"requires": true,
"packages": {
"": {
"name": "node-terminal",
- "version": "0.3.3",
+ "version": "0.3.4",
"hasInstallScript": true,
"license": "BUSL-1.1",
"dependencies": {
@@ -19,7 +19,7 @@
"emoji-picker-react": "^4.19.1",
"lucide-react": "^0.545.0",
"marked": "^12.0.2",
- "monaco-editor": "^0.56.0",
+ "monaco-editor": "0.56.0",
"node-pty": "^1.0.0",
"qrcode": "^1.5.4",
"sharp": "^0.35.3",
diff --git a/package.json b/package.json
index a09b030e1..a5626dad2 100644
--- a/package.json
+++ b/package.json
@@ -151,7 +151,7 @@
"emoji-picker-react": "^4.19.1",
"lucide-react": "^0.545.0",
"marked": "^12.0.2",
- "monaco-editor": "^0.56.0",
+ "monaco-editor": "0.56.0",
"node-pty": "^1.0.0",
"qrcode": "^1.5.4",
"sharp": "^0.35.3",
diff --git a/src/renderer/terminal/terminal-config.test.ts b/src/renderer/terminal/terminal-config.test.ts
index 206011779..bf103c9a6 100644
--- a/src/renderer/terminal/terminal-config.test.ts
+++ b/src/renderer/terminal/terminal-config.test.ts
@@ -550,9 +550,10 @@ describe('terminalKeyAction', () => {
expect(
terminalKeyAction(ev({ key: 'Enter', code: 'Enter', shiftKey: true }), false, false, true)
).toBe('shift-enter')
- // project-jump swallow wins over bubble
+ // project-jump bubbles to the dispatcher (which performs the switch) — it must
+ // still beat a registry bubble's reason but reach the window as a bubble, not a swallow
expect(terminalKeyAction(ev({ key: '1', code: 'Digit1', metaKey: true }), false, true, true)).toBe(
- 'swallow'
+ 'bubble'
)
// keyup never bubbles — the dispatcher only acts on keydown
expect(
@@ -571,9 +572,11 @@ describe('terminalKeyAction', () => {
// The jump-to-project chord: WHICH events are the chord is decided once, in lib/projectJump.ts
// (and tested there — layout, AltGr, keyup, digit range). This module only obeys the answer.
- it('swallows the jump-to-project chord so the PTY never sees the control byte', () => {
+ // It bubbles (not swallow) so the window dispatcher can perform the switch while still
+ // preventing the PTY control byte — see terminal-config.ts.
+ it('bubbles the jump-to-project chord so the PTY never sees the control byte', () => {
expect(terminalKeyAction(ev({ key: '1', code: 'Digit1', ctrlKey: true }), false, true)).toBe(
- 'swallow'
+ 'bubble'
)
})
diff --git a/src/renderer/terminal/terminal-config.ts b/src/renderer/terminal/terminal-config.ts
index dad792103..818367633 100644
--- a/src/renderer/terminal/terminal-config.ts
+++ b/src/renderer/terminal/terminal-config.ts
@@ -802,7 +802,13 @@ export function terminalKeyAction(
!e.altKey
)
return 'shift-enter'
- if (ownsProjectJump) return 'swallow'
+ // `ownsProjectJump` is a bubble, not a swallow: it must reach the window dispatcher
+ // that performs the actual project switch (see `lib/projectJump.ts` + Canvas
+ // `projectJumpGesture`), while still preventing xterm's control-byte write (Ctrl+2..8 are
+ // ^@ ^[ etc.). Swallowing with preventDefault would mark the event handled and the
+ // dispatcher bails on defaultPrevented — which is why Cmd+1 from a focused terminal
+ // (canvas or kanban modal) stopped switching.
+ if (ownsProjectJump) return 'bubble'
const base = copyKeyAction(e, hasSelection)
if (base !== 'pass') return base
// `registryOwns` — decided by the caller via `terminalChordBubbles`, the same live-registry