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.
TypeScript adhdagent-orchestrationai-agentscanvasclaude-codecodexcoding-agentsdeveloper-toolselectrongeminilinuxmacosmultiplexeropencodeparallel-agentsterminalterminal-emulatorterminal-multiplexertmuxworkspace-manager
fix: keep font override across xterm recreation; keypad Insert stays copy (#915)
Erik Zwep61ebdde8cffa
diff --git a/CLAUDE.md b/CLAUDE.mdindex e69cc671b..7a2529bab 100644--- a/CLAUDE.md+++ b/CLAUDE.md@@ -6505,6 +6505,9 @@ the Settings section and ShortcutsPanel start disagreeing about what a chord mea`terminalGpuRendering: 'shared'` a node whose size differs from the global one is held OFF theshared glyph canvas (`leavesSharedGlyphAtlas` → `glyphOff`) and paints its own pixels, because theshared atlas is rasterized for the global font and a grid's cell is fixed at `register`.+ Round 2: every xterm is BUILT from the effective visual (`visualRef`, both surfaces) — a refresh+ or offscreen revive recreates it in the same mount, where the live-options effect does not re-run;+ and keypad 0 resets only when it types `0` (Num Lock off it is Insert, and Ctrl+Insert copies).- **"Go to node" (`goToNode` → `frameNode`)** — the one camera-travel path (notification click,sessions sidebar, ⌘K jump, presence travel, minimap double-click, double-click focus).**It computes the viewport itself and applies it with `setViewport`. It must never go throughdiff --git a/src/renderer/components/kanban/ModalTerminal.tsx b/src/renderer/components/kanban/ModalTerminal.tsxindex 8035f96b9..26c745bd2 100644--- a/src/renderer/components/kanban/ModalTerminal.tsx+++ b/src/renderer/components/kanban/ModalTerminal.tsx@@ -159,6 +159,9 @@ export function ModalTerminal({ nodeId, spawn, searchOpen, onCloseSearch, covere// all — the per-project appearance would silently vanish for exactly those cards.// …and the NODE's own font size (issue #915), so this second view matches the canvas one.const visual = useXtermVisualSettings(owningProjectId(), spawn.terminalFontSize)+ // MIRROR TerminalNode: the xterm is BUILT from the effective appearance, not the bare globals.+ const visualRef = useRef(visual)+ visualRef.current = visual// Liquid Glass: the same glass as the canvas node (a second view of one session must look like// it). The DOM renderer keeps app-painted cell backgrounds opaque (see CLAUDE.md).const { glass, vars: glassVars } = useTerminalGlass(visual.terminalTheme)@@ -222,7 +225,7 @@ export function ModalTerminal({ nodeId, spawn, searchOpen, onCloseSearch, covere// Appearance comes from the SAME source as the canvas node's terminal — this modal is a second// view of one session, and a card that renders it in different colours reads as a different// terminal. (It used to hardcode its own background, which is exactly what happened.)- const term = new Terminal(xtermOptionsFromSettings(s, glassRef.current))+ const term = new Terminal(xtermOptionsFromSettings(visualRef.current, glassRef.current))// The same read-only rule as the canvas node: a hosted team's Viewer/Commenter never types here.if (isHostedReadOnly(session.id)) term.options.disableStdin = true// Without a handler xterm answers an OSC 8 click with a window.confirm — the one surfacediff --git a/src/renderer/nodes/TerminalNode.tsx b/src/renderer/nodes/TerminalNode.tsxindex fe550e4f0..2bd531eba 100644--- a/src/renderer/nodes/TerminalNode.tsx+++ b/src/renderer/nodes/TerminalNode.tsx@@ -1358,6 +1358,12 @@ export function TerminalNode({// `data.terminalFontSize` is this node's own ⌘+ / ⌘− size (issue #915), layered last by the hook// so the card modal (which passes the same value) re-options through the identical path.const visual = useXtermVisualSettings(owningProjectId(), data.terminalFontSize)+ // Mirrored for the lifecycle effect, which builds a NEW xterm on a refresh (`respawnNonce`) or an+ // offscreen revive without remounting — the [visual, glass] live-options effect does not re-run+ // then, so the instance must be born with the effective appearance (the node's font override, the+ // project's theme/font), not the bare global settings (review round 2 of #915).+ const visualRef = useRef(visual)+ visualRef.current = visual// The GLOBAL size the shared glyph atlas is rasterized for (see `fontLeavesAtlas`).const globalFontSize = useSettings((s) => s.settings.fontSize)// Glass terminals (Settings → Appearance): xterm paints no background and the node supplies a@@ -2406,7 +2412,8 @@ export function TerminalNode({const s = useSettings.getState().settings// Appearance comes from ONE place, shared with the kanban card modal's viewer of this same// session (`ModalTerminal`) — see `xtermOptionsFromSettings`.- const term = parked?.term ?? new Terminal(xtermOptionsFromSettings(s, isLiquidGlass(s.appTheme)))+ const term =+ parked?.term ?? new Terminal(xtermOptionsFromSettings(visualRef.current, isLiquidGlass(s.appTheme)))// A hosted team's Viewer/Commenter watches and never types: keystrokes and pastes are not taken// at all (the host refuses pty:write for them anyway). Set only for such a tab — every other// session never touches the option. The role is known before the session exists (relay-tab).diff --git a/src/renderer/terminal/terminal-font-zoom.test.ts b/src/renderer/terminal/terminal-font-zoom.test.tsindex 66b1bc74d..bc3f5d457 100644--- a/src/renderer/terminal/terminal-font-zoom.test.ts+++ b/src/renderer/terminal/terminal-font-zoom.test.ts@@ -222,3 +222,16 @@ describe('leavesSharedGlyphAtlas (review of #915: the shared atlas is one globalexpect(leavesSharedGlyphAtlas(12, 13)).toBe(true)})})++describe('keypad Insert stays a copy chord (review round 2 of #915)', () => {+ it('Ctrl+keypad-0 with Num Lock OFF (key Insert) is not a reset', () => {+ expect(terminalFontZoomChord(key({ ctrlKey: true, key: 'Insert', code: 'Numpad0' }), false)).toBeNull()+ expect(terminalFontZoomChord(key({ metaKey: true, key: 'Insert', code: 'Numpad0' }), true)).toBeNull()+ })+ it('Ctrl+keypad-0 with Num Lock ON (key 0) still resets', () => {+ expect(terminalFontZoomChord(key({ ctrlKey: true, key: '0', code: 'Numpad0' }), false)).toBe('reset')+ })+ it('the digit-row 0 resets on its physical key whatever key it reports (AZERTY)', () => {+ expect(terminalFontZoomChord(key({ ctrlKey: true, key: 'à', code: 'Digit0' }), false)).toBe('reset')+ })+})diff --git a/src/renderer/terminal/terminal-font-zoom.ts b/src/renderer/terminal/terminal-font-zoom.tsindex 3d79ad392..96ade5543 100644--- a/src/renderer/terminal/terminal-font-zoom.ts+++ b/src/renderer/terminal/terminal-font-zoom.ts@@ -57,7 +57,8 @@ export interface TerminalFontZoomEvent {* user presses for "bigger" is the one labelled +, which on a German layout is its own key* (`BracketRight`) and on US is ⇧= — so Shift is not constrained for these two.* - **0 matches on the physical key** (`e.code`), like the canvas ⌘0 and main's intercept, so the- * two agree about which key is "0" on AZERTY; ⌘⇧0 is a different chord.+ * two agree about which key is "0" on AZERTY; ⌘⇧0 is a different chord. Keypad 0 counts only+ * when it types a zero (Num Lock on), because with Num Lock off it is Insert — a copy chord.* - Alt is refused (AltGr reports as ctrl+alt off-mac and must keep typing its character).* - Auto-repeat is ACCEPTED: nothing here animates, and holding ⌘+ to keep growing is expected.*/@@ -70,7 +71,10 @@ export function terminalFontZoomChord(if (!primary) return nullif (e.key === '+' || e.key === '=' || e.code === 'NumpadAdd') return 'increase'if (e.key === '-' || e.code === 'NumpadSubtract') return 'decrease'- if (!e.shiftKey && (e.code === 'Digit0' || e.code === 'Numpad0')) return 'reset'+ // Keypad 0 only as a real zero: with Num Lock OFF it reports `key: 'Insert'`, and Ctrl+Insert is+ // the Windows/Linux COPY chord (`isCopyShortcut`) — claiming it here cleared the font instead of+ // copying (review round 2 of #915). The digit row stays positional, like the canvas ⌘0.+ if (!e.shiftKey && (e.code === 'Digit0' || (e.code === 'Numpad0' && e.key === '0'))) return 'reset'return null}diff --git a/src/renderer/terminal/terminal-font-zoom.wiring.test.ts b/src/renderer/terminal/terminal-font-zoom.wiring.test.tsindex 2da26a24e..c2b34a5d0 100644--- a/src/renderer/terminal/terminal-font-zoom.wiring.test.ts+++ b/src/renderer/terminal/terminal-font-zoom.wiring.test.ts@@ -79,6 +79,22 @@ describe('terminal font zoom — one options path', () => {})})+describe('terminal font zoom — every new xterm is built from the EFFECTIVE visual (review round 2)', () => {+ // A refresh (respawnNonce) or an offscreen-release revive recreates the xterm inside the same+ // mount, where the [visual, glass] live-options effect does NOT re-run — so the instance must be+ // born with the node's override (and the project's theme/font), never the bare global settings.+ for (const [name, src] of [+ ['TerminalNode', TERMINAL_NODE],+ ['ModalTerminal', MODAL]+ ] as const) {+ it(`${name}: new Terminal(...) reads visualRef.current, mirrored every render`, () => {+ const ctor = src.slice(src.indexOf('new Terminal(xtermOptionsFromSettings('))+ expect(ctor.slice(0, ctor.indexOf('\n'))).toContain('xtermOptionsFromSettings(visualRef.current,')+ expect(src).toContain('visualRef.current = visual')+ })+ }+})+describe('terminal font zoom — key wiring', () => {for (const [name, src] of [['TerminalNode', TERMINAL_NODE],