Nano zoom fix #13
This commit is contained in:
@@ -100,6 +100,11 @@ const App = () => {
|
||||
socket.current.onmessage = (event) => {
|
||||
console.log('Received message:', event.data);
|
||||
terminal.current.write(event.data);
|
||||
|
||||
const parsedData = JSON.parse(event.data);
|
||||
if (parsedData.type === 'process_closed') {
|
||||
notifyServerOfResize();
|
||||
}
|
||||
};
|
||||
|
||||
socket.current.onerror = (error) => {
|
||||
@@ -114,6 +119,21 @@ const App = () => {
|
||||
};
|
||||
};
|
||||
|
||||
const notifyServerOfResize = () => {
|
||||
if (socket.current && socket.current.readyState === WebSocket.OPEN) {
|
||||
const { rows, cols } = terminal.current;
|
||||
socket.current.send(
|
||||
JSON.stringify({
|
||||
type: 'resize',
|
||||
rows,
|
||||
cols,
|
||||
height: terminalRef.current.offsetHeight,
|
||||
width: terminalRef.current.offsetWidth,
|
||||
})
|
||||
);
|
||||
}
|
||||
};
|
||||
|
||||
const handleInputChange = (event, setState) => {
|
||||
setState(event.target.value);
|
||||
};
|
||||
|
||||
Reference in New Issue
Block a user