fix: reduce minimum font size and prevent reconnection on font size change
- Reduce MIN_FONT_SIZE from 16 to 10 for better range - Remove calculateFontSize from useEffect dependencies to prevent terminal re-initialization when font size changes - Font size changes now update xterm options directly without disposing/recreating the terminal (no WebSocket reconnection)
This commit is contained in:
@@ -21,7 +21,7 @@ interface TerminalProps {
|
|||||||
}
|
}
|
||||||
|
|
||||||
const FONT_SIZE_KEY = "terminal-font-size";
|
const FONT_SIZE_KEY = "terminal-font-size";
|
||||||
const MIN_FONT_SIZE = 16;
|
const MIN_FONT_SIZE = 10;
|
||||||
const MAX_FONT_SIZE = 24;
|
const MAX_FONT_SIZE = 24;
|
||||||
const RECONNECT_ATTEMPTS = 3;
|
const RECONNECT_ATTEMPTS = 3;
|
||||||
const RECONNECT_DELAY_BASE = 1000;
|
const RECONNECT_DELAY_BASE = 1000;
|
||||||
@@ -242,7 +242,8 @@ export const TerminalComponent: React.FC<TerminalProps> = ({
|
|||||||
ws.close();
|
ws.close();
|
||||||
term.dispose();
|
term.dispose();
|
||||||
};
|
};
|
||||||
}, [instanceId, connectWebSocket, calculateFontSize]);
|
// eslint-disable-next-line react-hooks/exhaustive-deps
|
||||||
|
}, [instanceId, connectWebSocket]);
|
||||||
|
|
||||||
// Update parent about status changes
|
// Update parent about status changes
|
||||||
useEffect(() => {
|
useEffect(() => {
|
||||||
|
|||||||
Reference in New Issue
Block a user