public inbox for pve-devel@lists.proxmox.com
 help / color / mirror / Atom feed
* [pve-devel] [PATCH] fix #6223: fit terminal after 'OK' message
@ 2025-03-18  9:09 Dominik Csapak
  0 siblings, 0 replies; only message in thread
From: Dominik Csapak @ 2025-03-18  9:09 UTC (permalink / raw)
  To: pve-devel

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.csapak@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


^ permalink raw reply	[flat|nested] only message in thread

only message in thread, other threads:[~2025-03-18  9:09 UTC | newest]

Thread overview: (only message) (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2025-03-18  9:09 [pve-devel] [PATCH] fix #6223: fit terminal after 'OK' message Dominik Csapak

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox
Service provided by Proxmox Server Solutions GmbH | Privacy | Legal