1
0
Fork 0
mirror of https://github.com/Ylianst/MeshCentral.git synced 2025-03-09 15:40:18 +00:00

Add dynamic resizing support to xterm.js terminal

This commit is contained in:
TotallyNotElite 2020-01-25 12:08:01 +01:00
parent 785cbd8f3a
commit 69846d5982
2 changed files with 24 additions and 18 deletions

View file

@ -91,7 +91,6 @@
// When the user resizes the window, re-fit
window.onresize = function () {
if (termfit != null) { termfit.fit(); }
if (resizeTimer == null) { resizeTimer = setTimeout(sendResize, 200); }
}
// Update the terminal status and buttons
@ -143,8 +142,12 @@
if (termfit) { term.loadAddon(termfit); }
term.open(Q('terminal'));
term.onData(function (data) { if (tunnel != null) { tunnel.sendText(data); } })
term.onResize(function (size) { if (resizeTimer == null) { resizeTimer = setTimeout(sendResize, 200); } });
if (termfit) { termfit.fit(); }
term.onResize(function (size) {
// Despam resize
if (resizeTimer) clearTimeout(resizeTimer);
resizeTimer = setTimeout(sendResize, 200);
});
// Setup a terminal tunnel to the agent
tunnel = CreateAgentRedirect(meshserver, CreateRemoteTunnel(tunnelUpdate), serverPublicNamePort, authCookie, authRelayCookie, domainUrl);