mirror of
https://github.com/NousResearch/hermes-agent.git
synced 2026-07-01 12:02:05 +00:00
fix(desktop): force a repaint when a terminal is re-activated
A WebGL terminal doesn't paint while visibility:hidden, so switching to it (e.g. after closing the active tab) revealed a stale/garbled frame. On activation, clear the glyph atlas and force a full term.refresh against the live buffer (after the refit), then focus.
This commit is contained in:
parent
b02f453496
commit
6e12f8ce4a
1 changed files with 8 additions and 3 deletions
|
|
@ -708,16 +708,21 @@ export function useTerminalSession({ id, cwd, active, onAddSelectionToChat, onSh
|
|||
return term ? registerTerminalReader(id, makeTerminalReader(term)) : undefined
|
||||
}, [id, status])
|
||||
|
||||
// On (re)activation the host went display:none→visible: focus it and refit so
|
||||
// a stale 0×0 fit from while it was hidden doesn't strand the prompt.
|
||||
// On (re)activation: a WebGL terminal doesn't paint while visibility:hidden, so
|
||||
// it reveals a stale/garbled frame. Refit, rebuild the glyph atlas, and force a
|
||||
// full redraw against the live buffer, then focus.
|
||||
useEffect(() => {
|
||||
if (!active || status !== 'open') {
|
||||
return
|
||||
}
|
||||
|
||||
const frame = requestAnimationFrame(() => {
|
||||
const term = termRef.current
|
||||
|
||||
fitRef.current?.()
|
||||
termRef.current?.focus()
|
||||
webglRef.current?.clearTextureAtlas()
|
||||
term?.refresh(0, term.rows - 1)
|
||||
term?.focus()
|
||||
})
|
||||
|
||||
return () => cancelAnimationFrame(frame)
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue