diff --git a/pkg/interface/src/views/apps/term/app.tsx b/pkg/interface/src/views/apps/term/app.tsx index fb830b678..d1d27d5d2 100644 --- a/pkg/interface/src/views/apps/term/app.tsx +++ b/pkg/interface/src/views/apps/term/app.tsx @@ -333,14 +333,21 @@ export default function TermApp(props: TermAppProps) { }); }, [sessions, api.term]); + const onResize = useCallback(() => { + //TODO debounce, if it ever becomes a problem + sessions[selected].fit.fit(); + }, [sessions, selected]); + // on-init, open slogstream // useEffect(() => { setupSlog(); + window.addEventListener('resize', onResize); return () => { //TODO clean up subs? + window.removeEventListener('resize', onResize); }; - }, []); + }, [onResize]); // on dark mode change, change terminals' theme // @@ -377,7 +384,9 @@ export default function TermApp(props: TermAppProps) { // term.onData((e) => onInput(selected, e)); term.onBinary((e) => onInput(selected, e)); - //TODO term.onResize + term.onResize((e) => { + api.term.sendTask(selected, { blew: { w: e.cols, h: e.rows } }); + }); ses = { term, fit }; @@ -401,7 +410,7 @@ export default function TermApp(props: TermAppProps) { if (container.current && !container.current.contains(ses.term.element || null)) { ses.term.open(container.current); - ses.fit.fit(); //TODO if not default, send %blew + ses.fit.fit(); ses.term.focus(); } @@ -421,16 +430,17 @@ export default function TermApp(props: TermAppProps) {