* [pve-devel] [PATCH v2] fix #6223: fit terminal after 'OK' message
@ 2025-04-07 8:25 Dominik Csapak
2025-04-07 10:31 ` [pve-devel] applied: " Thomas Lamprecht
0 siblings, 1 reply; 2+ messages in thread
From: Dominik Csapak @ 2025-04-07 8:25 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.
Execute after the next frame, by using requestAnimationFrame twice. (One
for the current frame and one for the next), to show terminal content as
soon as possible.
Signed-off-by: Dominik Csapak <d.csapak@proxmox.com>
---
changes from v1:
* use requestAnimationFrame instead of setTimeout with arbitrary delay
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..902a1c3 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));
+
+ // delay initial focus and resize to after next frame
+ requestAnimationFrame(() => requestAnimationFrame(() => {
+ term.focus();
+ fitAddon.fit();
+ }));
} 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] 2+ messages in thread
* [pve-devel] applied: [PATCH v2] fix #6223: fit terminal after 'OK' message
2025-04-07 8:25 [pve-devel] [PATCH v2] fix #6223: fit terminal after 'OK' message Dominik Csapak
@ 2025-04-07 10:31 ` Thomas Lamprecht
0 siblings, 0 replies; 2+ messages in thread
From: Thomas Lamprecht @ 2025-04-07 10:31 UTC (permalink / raw)
To: pve-devel, Dominik Csapak
On Mon, 07 Apr 2025 10:25:09 +0200, Dominik Csapak wrote:
> instead of simply waiting 250ms after we send the credentials, wait
> until after the server responded with 'OK' to fit the terminal size.
>
> Execute after the next frame, by using requestAnimationFrame twice. (One
> for the current frame and one for the next), to show terminal content as
> soon as possible.
>
> [...]
Applied, thanks!
[1/1] fix #6223: fit terminal after 'OK' message
commit: 5b0b0545a603962898d0438bdeff9307c4426444
_______________________________________________
pve-devel mailing list
pve-devel@lists.proxmox.com
https://lists.proxmox.com/cgi-bin/mailman/listinfo/pve-devel
^ permalink raw reply [flat|nested] 2+ messages in thread
end of thread, other threads:[~2025-04-07 10:31 UTC | newest]
Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2025-04-07 8:25 [pve-devel] [PATCH v2] fix #6223: fit terminal after 'OK' message Dominik Csapak
2025-04-07 10:31 ` [pve-devel] applied: " Thomas Lamprecht
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