Skip to content

Commit dbd0d7d

Browse files
committed
refac
1 parent afa0609 commit dbd0d7d

1 file changed

Lines changed: 6 additions & 0 deletions

File tree

src/lib/components/chat/XTerminal.svelte

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -105,6 +105,8 @@
105105
}
106106
connected = true;
107107
connecting = false;
108+
// Focus the terminal so it receives keyboard input immediately
109+
term?.focus();
108110
// Send initial resize
109111
if (term && ws) {
110112
ws.send(JSON.stringify({ type: 'resize', cols: term.cols, rows: term.rows }));
@@ -226,6 +228,10 @@
226228
}
227229
});
228230
231+
// Ensure all key events are processed by xterm.js and not intercepted
232+
// by the browser or surrounding UI (fixes vi/vim keystroke handling).
233+
term.attachCustomKeyEventHandler(() => true);
234+
229235
// Handle resize
230236
term.onResize(({ cols, rows }) => {
231237
if (ws && ws.readyState === WebSocket.OPEN) {

0 commit comments

Comments
 (0)