@@ -1247,11 +1247,13 @@ <h3>Session expired</h3>
12471247 async function initApp ( ) {
12481248 try {
12491249 await loadScript ( '/static/js/xterm.js' ) ;
1250- document . getElementById ( 'progress-bar' ) . style . width = '25%' ;
1250+ document . getElementById ( 'progress-bar' ) . style . width = '20%' ;
1251+ await loadScript ( '/static/js/xterm-addon-webgl.js' ) ;
1252+ document . getElementById ( 'progress-bar' ) . style . width = '40%' ;
12511253 await loadScript ( '/static/js/socket.io.min.js' ) ;
1252- document . getElementById ( 'progress-bar' ) . style . width = '50 %' ;
1254+ document . getElementById ( 'progress-bar' ) . style . width = '60 %' ;
12531255 await loadScript ( '/static/js/xterm-addon-fit.js' ) ;
1254- document . getElementById ( 'progress-bar' ) . style . width = '75 %' ;
1256+ document . getElementById ( 'progress-bar' ) . style . width = '80 %' ;
12551257 await loadScript ( '/static/js/xterm-addon-web-links.js' ) ;
12561258 document . getElementById ( 'progress-bar' ) . style . width = '100%' ;
12571259 } catch ( e ) {
@@ -2317,6 +2319,24 @@ <h3>Session expired</h3>
23172319 return term ;
23182320 }
23192321
2322+ function enableWebglRenderer ( state ) {
2323+ if ( ! state || ! state . term || typeof WebglAddon === 'undefined' ) return ;
2324+ let addon = null ;
2325+ try {
2326+ // Keep the drawing buffer readable for Agent viewport PNG capture.
2327+ addon = new WebglAddon . WebglAddon ( true ) ;
2328+ addon . onContextLoss ( ( ) => {
2329+ addon . dispose ( ) ;
2330+ if ( state . webglAddon === addon ) state . webglAddon = null ;
2331+ } ) ;
2332+ state . term . loadAddon ( addon ) ;
2333+ state . webglAddon = addon ;
2334+ } catch ( error ) {
2335+ if ( addon ) addon . dispose ( ) ;
2336+ console . warn ( 'WebGL terminal renderer unavailable; using DOM renderer.' , error ) ;
2337+ }
2338+ }
2339+
23202340 function syncAgentTerminalMirrorSize ( state ) {
23212341 if ( ! state || ! state . agentTerminalMirror || ! state . term ) return ;
23222342 const cols = state . term . cols ;
@@ -3496,6 +3516,7 @@ <h3>Session expired</h3>
34963516 titleEl,
34973517 term,
34983518 fitAddon,
3519+ webglAddon : null ,
34993520 webLinksAddon : null ,
35003521 inPip : false ,
35013522 pipWindow : null ,
@@ -3509,6 +3530,7 @@ <h3>Session expired</h3>
35093530 pipPagehideHandler : null ,
35103531 pipResizeHandler : null
35113532 } ;
3533+ enableWebglRenderer ( state ) ;
35123534 terminals . set ( terminalId , state ) ;
35133535 configureWebLinks ( state ) ;
35143536 syncAgentTerminalMirrorSize ( state ) ;
@@ -3539,6 +3561,7 @@ <h3>Session expired</h3>
35393561 } ) ;
35403562 detachAgentFromTerminal ( state , { notifyServer } ) ;
35413563 if ( state . webLinksAddon ) state . webLinksAddon . dispose ( ) ;
3564+ if ( state . webglAddon ) state . webglAddon . dispose ( ) ;
35423565 if ( state . agentTerminalMirror ) state . agentTerminalMirror . dispose ( ) ;
35433566 state . term . dispose ( ) ;
35443567 state . container . remove ( ) ;
@@ -3729,6 +3752,7 @@ <h3>Session expired</h3>
37293752 fontSize : state . term . options . fontSize ,
37303753 fontWeight : state . term . options . fontWeight ,
37313754 colorScheme : prefs . colorScheme ,
3755+ renderer : state . webglAddon ? 'webgl' : 'dom' ,
37323756 mirrorCursorStyle : state . agentTerminalMirror
37333757 ? state . agentTerminalMirror . options . cursorStyle
37343758 : null ,
0 commit comments