fix: force xterm.js canvas redraw on resize via internal renderer
This commit is contained in:
@@ -219,9 +219,15 @@ export const TerminalComponent: React.FC<TerminalProps> = ({
|
|||||||
if (!fitAddonRef.current || !termRef.current) return;
|
if (!fitAddonRef.current || !termRef.current) return;
|
||||||
const oldCols = termRef.current.cols;
|
const oldCols = termRef.current.cols;
|
||||||
const oldRows = termRef.current.rows;
|
const oldRows = termRef.current.rows;
|
||||||
|
|
||||||
|
// Force layout recalculation before fit
|
||||||
|
if (container) {
|
||||||
|
void container.offsetWidth;
|
||||||
|
void container.offsetHeight;
|
||||||
|
}
|
||||||
|
|
||||||
fitAddonRef.current.fit();
|
fitAddonRef.current.fit();
|
||||||
const { cols, rows } = termRef.current;
|
const { cols, rows } = termRef.current;
|
||||||
// Force refresh if dimensions changed
|
|
||||||
if (cols !== oldCols || rows !== oldRows) {
|
if (cols !== oldCols || rows !== oldRows) {
|
||||||
termRef.current.refresh(0, rows - 1);
|
termRef.current.refresh(0, rows - 1);
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user