instead of simply waiting 250ms after we send the credentials, wait until after the server responded with 'OK' to fit the terminal size. Still keep the timeout to not do that in the onmessage handler itself, but rather at a later point in time.
This fixes an issue with not properly fitted area, when it takes longer than 250ms to establish the connection and the first fit would be before we could send the client size to the server. Signed-off-by: Dominik Csapak <d.csa...@proxmox.com> --- xterm.js/src/main.js | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-) diff --git a/xterm.js/src/main.js b/xterm.js/src/main.js index 289032c..b4b5c43 100644 --- a/xterm.js/src/main.js +++ b/xterm.js/src/main.js @@ -222,6 +222,12 @@ function runTerminal() { if (answer[0] === 79 && answer[1] === 75) { // "OK" updateState(states.connected); term.write(answer.slice(2)); + + // initial focus and resize + setTimeout(function() { + term.focus(); + fitAddon.fit(); + }, 250); } else { socket.close(); } @@ -247,12 +253,6 @@ function runTerminal() { }); socket.send(PVE.UserName + ':' + ticket + "\n"); - - // initial focus and resize - setTimeout(function() { - term.focus(); - fitAddon.fit(); - }, 250); } function getLxcStatus(callback) { -- 2.39.5 _______________________________________________ pve-devel mailing list pve-devel@lists.proxmox.com https://lists.proxmox.com/cgi-bin/mailman/listinfo/pve-devel