From dbd0d7d74201223b3c6ef943509470bf0156954a Mon Sep 17 00:00:00 2001 From: Timothy Jaeryang Baek Date: Wed, 11 Mar 2026 17:17:35 -0500 Subject: [PATCH] refac --- src/lib/components/chat/XTerminal.svelte | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/src/lib/components/chat/XTerminal.svelte b/src/lib/components/chat/XTerminal.svelte index e10ba0259..9d862e7ae 100644 --- a/src/lib/components/chat/XTerminal.svelte +++ b/src/lib/components/chat/XTerminal.svelte @@ -105,6 +105,8 @@ } connected = true; connecting = false; + // Focus the terminal so it receives keyboard input immediately + term?.focus(); // Send initial resize if (term && ws) { ws.send(JSON.stringify({ type: 'resize', cols: term.cols, rows: term.rows })); @@ -226,6 +228,10 @@ } }); + // Ensure all key events are processed by xterm.js and not intercepted + // by the browser or surrounding UI (fixes vi/vim keystroke handling). + term.attachCustomKeyEventHandler(() => true); + // Handle resize term.onResize(({ cols, rows }) => { if (ws && ws.readyState === WebSocket.OPEN) {