fix(shell): prevent Enter in AI chat from leaking to terminal
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 <crush@charm.land>
This commit is contained in:
@@ -693,7 +693,7 @@ export default function Shell({ api }) {
|
|||||||
|
|
||||||
if (!fromEvent) {
|
if (!fromEvent) {
|
||||||
setAiInput('')
|
setAiInput('')
|
||||||
focusAiTerminal()
|
setTimeout(() => focusAiTerminal(), 0)
|
||||||
}
|
}
|
||||||
|
|
||||||
if (trimmed === '/clear') {
|
if (trimmed === '/clear') {
|
||||||
@@ -937,7 +937,7 @@ export default function Shell({ api }) {
|
|||||||
<input
|
<input
|
||||||
value={aiInput}
|
value={aiInput}
|
||||||
onChange={e => setAiInput(e.target.value)}
|
onChange={e => 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')}
|
placeholder={aiAtLimit ? '/clear pour continuer' : t('shell.askAi')}
|
||||||
disabled={aiAtLimit && aiInput !== '/clear'}
|
disabled={aiAtLimit && aiInput !== '/clear'}
|
||||||
/>
|
/>
|
||||||
|
|||||||
Reference in New Issue
Block a user