mirror of
https://github.com/NousResearch/hermes-agent.git
synced 2026-07-10 13:31:38 +00:00
opentui(v5b): fix first-letter duplication on always-active refocus
Typing while the textarea was unfocused doubled the FIRST letter: the always-active handler did ta.focus() AND ta.insertText(key.sequence), but the renderer runs the global useKeyboard handler BEFORE routing the key to the focused renderable — so after focus() the same keystroke was also delivered to the now-focused textarea, inserting it twice. Subsequent keys were fine (textarea already focused → block skipped). Fix: focus() only; let the textarea insert the char it now receives. Verified live: typing 'x' then 'y' while blurred yields '❯ xy' (no dup). 85 pass.
This commit is contained in:
parent
2cd122c9c1
commit
49d90e68c6
1 changed files with 4 additions and 3 deletions
|
|
@ -146,11 +146,12 @@ export function Composer(props: {
|
|||
}
|
||||
}
|
||||
// 3) always-active input (item 2): a printable key while the textarea lost
|
||||
// focus reclaims it AND recovers the char (the in-flight event went to this
|
||||
// global handler, not the unfocused textarea). Nav/scroll keys are untouched.
|
||||
// focus reclaims it. The renderer runs this GLOBAL handler BEFORE routing the
|
||||
// key to the focused renderable, so after focus() the SAME keystroke is still
|
||||
// delivered to the (now-focused) textarea — do NOT insert it here too, or the
|
||||
// first letter doubles. Nav/scroll keys are untouched.
|
||||
if (ta && !ta.focused && isPrintableKey(key)) {
|
||||
ta.focus()
|
||||
ta.insertText(key.sequence)
|
||||
}
|
||||
})
|
||||
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue