added resize back

This commit is contained in:
ACoolName 2024-05-27 23:03:03 +03:00
parent 8b9138119c
commit f2e33ba8e6

View File

@ -48,8 +48,13 @@ function TerminalComponent (p: {websocket: string|null}) {
const socket = new WebSocket(websocket);
socket.addEventListener('open', () => {
socket.send(JSON.stringify({CommandType: 'resize', Arguments: [terminal.current?.rows, terminal.current?.cols]}));
});
terminal.current.onResize(({cols, rows})=>{
socket.send(JSON.stringify({CommandType: 'resize', Arguments: [rows, cols]}));
})
socket.addEventListener('message', (event) => {
terminal.current?.write(JSON.parse(event.data));
});