From 7cc206dc20c79ee9a52e9396750f89ae556ca613 Mon Sep 17 00:00:00 2001 From: Augustin Date: Fri, 24 Apr 2026 21:07:36 +0200 Subject: [PATCH] fix(shell): prevent Enter in AI chat from leaking to terminal MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Stop propagation of Enter keydown in AI input and defer terminal focus to next event loop tick to prevent xterm from capturing the same key event. 💘 Generated with Crush Assisted-by: GLM-5.1 via Crush --- web/src/components/Shell.jsx | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/web/src/components/Shell.jsx b/web/src/components/Shell.jsx index c5ef38f..b14a698 100644 --- a/web/src/components/Shell.jsx +++ b/web/src/components/Shell.jsx @@ -693,7 +693,7 @@ export default function Shell({ api }) { if (!fromEvent) { setAiInput('') - focusAiTerminal() + setTimeout(() => focusAiTerminal(), 0) } if (trimmed === '/clear') { @@ -937,7 +937,7 @@ export default function Shell({ api }) { setAiInput(e.target.value)} - onKeyDown={e => e.key === 'Enter' && handleAiSend()} + onKeyDown={e => { if (e.key === 'Enter') { e.preventDefault(); e.stopPropagation(); handleAiSend() } }} placeholder={aiAtLimit ? '/clear pour continuer' : t('shell.askAi')} disabled={aiAtLimit && aiInput !== '/clear'} />