Fix xterm in shared terminals

Gary Kim committed Nov 24, 2022 at 00:59 UTC 4e24783662f9a795e66279fc818cccd13b800fcc
2 files changed +16 -4
views/sharing-mobile.handlebars
+7 -1
@@ -1670,7 +1670,13 @@
1670 return obj;
1671 }
1672
1673 - function tunnelUpdate(data) { if (typeof data == 'string') { xterm.writeUtf8(data); } else { xterm.writeUtf8(new Uint8Array(data)); } }
1673 + function tunnelUpdate(data) {
1674 + if (xterm.writeUtf8) {
1675 + if (typeof data == 'string') { xterm.writeUtf8(data); } else { xterm.writeUtf8(new Uint8Array(data)); }
1676 + } else {
1677 + if (typeof data == 'string') { xterm.write(data); } else { xterm.write(new Uint8Array(data)); }
1678 + }
1679 + }
1680
1681 function sshTunnelUpdate(data) {
1682 if (typeof data == 'string') {
views/sharing.handlebars
+9 -3
@@ -393,7 +393,7 @@
393 }
394
395 function deskAdjust() {
396 - if ((xxcurrentView == 12) && (terminal != null) && (xtermfit != null)) { xtermfit.fit(); } // Terminal
396 + if ((xxcurrentView == 12) && (terminal != null) && (xtermfit != null)) { xtermfit.fit(); } // Terminal
397 QS('fileArea4')['height'] = 'calc(100vh - ' + (90 + Q('fileArea2').clientHeight) + 'px)'; // Files
398 var parentH = Q('DeskParent').clientHeight, parentW = Q('DeskParent').clientWidth;
399 var deskH = Q('Desk').height, deskW = Q('Desk').width;
@@ -1405,7 +1405,13 @@
1405 return obj;
1406 }
1407
1408 - function tunnelUpdate(data) { if (typeof data == 'string') { xterm.writeUtf8(data); } else { xterm.writeUtf8(new Uint8Array(data)); } }
1408 + function tunnelUpdate(data) {
1409 + if (xterm.writeUtf8) {
1410 + if (typeof data == 'string') { xterm.writeUtf8(data); } else { xterm.writeUtf8(new Uint8Array(data)); }
1411 + } else {
1412 + if (typeof data == 'string') { xterm.write(data); } else { xterm.write(new Uint8Array(data)); }
1413 + }
1414 + }
1415
1416 // Send the new terminal size to the agent
1417 function xTermSendResize() {
@@ -1567,7 +1573,7 @@
1573
1574 //
1575 // Files
1570 - //
1576 + //
1577
1578 function setupFiles() {
1579 // Setup the files tab