fix: send stty resize on every resize with hidden command output
Backend: - Remove _stty_sent guard to send stty on EVERY resize - Use stty -echo to hide command, then delete the command line with ANSI escapes - Change log level from info to debug Frontend: - Add window resize listener as fallback to ResizeObserver - 250ms debounce to avoid excessive refits - Proper cleanup on unmount
This commit is contained in:
@@ -284,6 +284,16 @@ export const TerminalComponent: React.FC<TerminalProps> = ({
|
||||
});
|
||||
resizeObserver.observe(container);
|
||||
|
||||
// Window resize fallback (for viewport changes that don't affect container dimensions)
|
||||
let windowResizeTimeout: ReturnType<typeof setTimeout>;
|
||||
const handleWindowResize = () => {
|
||||
clearTimeout(windowResizeTimeout);
|
||||
windowResizeTimeout = setTimeout(() => {
|
||||
requestAnimationFrame(() => fitTerminal());
|
||||
}, 250);
|
||||
};
|
||||
window.addEventListener("resize", handleWindowResize);
|
||||
|
||||
// Refit after mobile header auto-hides (3s delay + 0.3s transition)
|
||||
const headerHideTimeout = setTimeout(() => {
|
||||
fitTerminal();
|
||||
@@ -316,8 +326,10 @@ export const TerminalComponent: React.FC<TerminalProps> = ({
|
||||
|
||||
return () => {
|
||||
clearTimeout(resizeTimeout);
|
||||
clearTimeout(windowResizeTimeout);
|
||||
clearTimeout(headerHideTimeout);
|
||||
resizeObserver.disconnect();
|
||||
window.removeEventListener("resize", handleWindowResize);
|
||||
document.removeEventListener("visibilitychange", handleVisibilityChange);
|
||||
if (ws) {
|
||||
ws.close();
|
||||
|
||||
Reference in New Issue
Block a user