@@ -35,6 +35,7 @@ import { TerminalProcessManager } from 'vs/workbench/contrib/terminal/browser/te
3535import type { Terminal as XTermTerminal , IBuffer , ITerminalAddon } from 'xterm' ;
3636import type { SearchAddon , ISearchOptions } from 'xterm-addon-search' ;
3737import type { Unicode11Addon } from 'xterm-addon-unicode11' ;
38+ import type { WebglAddon } from 'xterm-addon-webgl' ;
3839import { CommandTrackerAddon } from 'vs/workbench/contrib/terminal/browser/addons/commandTrackerAddon' ;
3940import { NavigationModeAddon } from 'vs/workbench/contrib/terminal/browser/addons/navigationModeAddon' ;
4041import { XTermCore } from 'vs/workbench/contrib/terminal/browser/xterm-private' ;
@@ -105,6 +106,7 @@ export class TerminalInstance extends Disposable implements ITerminalInstance {
105106 private _widgetManager : TerminalWidgetManager = this . _instantiationService . createInstance ( TerminalWidgetManager ) ;
106107 private _linkManager : TerminalLinkManager | undefined ;
107108 private _environmentInfo : { widget : EnvironmentVariableInfoWidget , disposable : IDisposable } | undefined ;
109+ private _webglAddon : WebglAddon | undefined ;
108110 private _commandTrackerAddon : CommandTrackerAddon | undefined ;
109111 private _navigationModeAddon : INavigationMode & ITerminalAddon | undefined ;
110112
@@ -497,7 +499,8 @@ export class TerminalInstance extends Disposable implements ITerminalInstance {
497499 xterm . open ( this . _xtermElement ) ;
498500 if ( this . _configHelper . config . rendererType === 'experimentalWebgl' ) {
499501 this . _terminalInstanceService . getXtermWebglConstructor ( ) . then ( Addon => {
500- xterm . loadAddon ( new Addon ( ) ) ;
502+ this . _webglAddon = new Addon ( ) ;
503+ xterm . loadAddon ( this . _webglAddon ) ;
501504 } ) ;
502505 }
503506
@@ -767,7 +770,8 @@ export class TerminalInstance extends Disposable implements ITerminalInstance {
767770 if ( ! this . _xterm ) {
768771 return ;
769772 }
770- this . _xterm . refresh ( 0 , this . _xterm . rows - 1 ) ;
773+ this . _webglAddon ?. clearTextureAtlas ( ) ;
774+ // TODO: Do other renderers?
771775 }
772776
773777 public focus ( force ?: boolean ) : void {
@@ -1228,6 +1232,8 @@ export class TerminalInstance extends Disposable implements ITerminalInstance {
12281232 this . _safeSetOption ( 'rightClickSelectsWord' , config . rightClickBehavior === 'selectWord' ) ;
12291233 this . _safeSetOption ( 'wordSeparator' , config . wordSeparators ) ;
12301234 if ( config . rendererType !== 'experimentalWebgl' ) {
1235+ // TODO: Unset/dispose this._webglAddon
1236+
12311237 // Never set webgl as it's an addon not a rendererType
12321238 this . _safeSetOption ( 'rendererType' , config . rendererType === 'auto' ? 'canvas' : config . rendererType ) ;
12331239 }
0 commit comments