opentui(v6): tray-exit Esc never arms the prompt-history double-press

This commit is contained in:
alt-glitch 2026-06-10 21:58:15 +05:30
parent 4c630d3e7b
commit f4bb617f62
2 changed files with 5 additions and 1 deletions

View File

@ -133,6 +133,10 @@ export function AgentsTray(props: {
boxRef?.blur() boxRef?.blur()
setFocused(false) setFocused(false)
props.onExit?.() props.onExit?.()
// A tray-exit Esc is CONSUMED — without this, a composer remount can
// register its handler after ours and the same keystroke would arm the
// Esc+Esc prompt-history double-press (Epic 5 review caveat).
key.preventDefault()
} }
}) })

View File

@ -322,7 +322,7 @@ export function Composer(props: {
// With text in the buffer the Esc is just an intervening key (disarms); // With text in the buffer the Esc is just an intervening key (disarms);
// unfocused (e.g. the agents tray owns the keys) it never counts. // unfocused (e.g. the agents tray owns the keys) it never counts.
if (key.name === 'escape' && key.eventType !== 'release' && !key.ctrl && !key.meta && !key.option) { if (key.name === 'escape' && key.eventType !== 'release' && !key.ctrl && !key.meta && !key.option) {
if (ta?.focused === true && ta.plainText === '') { if (ta?.focused === true && ta.plainText === '' && !key.defaultPrevented) {
if (doubleEsc.press()) props.onDoubleEsc?.() if (doubleEsc.press()) props.onDoubleEsc?.()
} else { } else {
doubleEsc.reset() doubleEsc.reset()