From 64d8fca3086d5ff7e7818a6ddd4567adcae0b33b Mon Sep 17 00:00:00 2001 From: Daniel Imms <2193314+Tyriar@users.noreply.github.com> Date: Tue, 5 Nov 2024 08:50:48 -0800 Subject: [PATCH] Ensure ligatures addon is activated after terminal open Fixes #233088 --- .../terminal/browser/xterm/xtermTerminal.ts | 18 ++++++++++-------- .../browser/terminalStickyScrollOverlay.ts | 16 ++++++++-------- 2 files changed, 18 insertions(+), 16 deletions(-) diff --git a/src/vs/workbench/contrib/terminal/browser/xterm/xtermTerminal.ts b/src/vs/workbench/contrib/terminal/browser/xterm/xtermTerminal.ts index 0f7521436a184..fb5f0ddaf9420 100644 --- a/src/vs/workbench/contrib/terminal/browser/xterm/xtermTerminal.ts +++ b/src/vs/workbench/contrib/terminal/browser/xterm/xtermTerminal.ts @@ -341,8 +341,6 @@ export class XtermTerminal extends Disposable implements IXtermTerminal, IDetach } } - this._refreshLigaturesAddon(); - if (!this.raw.element || !this.raw.textarea) { throw new Error('xterm elements not set after open'); } @@ -365,6 +363,8 @@ export class XtermTerminal extends Disposable implements IXtermTerminal, IDetach } }, { passive: true })); + this._refreshLigaturesAddon(); + this._attached = { container, options }; // Screen must be created at this point as xterm.open is called return this._attached?.container.querySelector('.xterm-screen')!; @@ -411,14 +411,16 @@ export class XtermTerminal extends Disposable implements IXtermTerminal, IDetach showTopBorder: true, }; this._updateSmoothScrolling(); - if (this._attached?.options.enableGpu) { - if (this._shouldLoadWebgl()) { - this._enableWebglRenderer(); - } else { - this._disposeOfWebglRenderer(); + if (this._attached) { + if (this._attached.options.enableGpu) { + if (this._shouldLoadWebgl()) { + this._enableWebglRenderer(); + } else { + this._disposeOfWebglRenderer(); + } } + this._refreshLigaturesAddon(); } - this._refreshLigaturesAddon(); } private _updateSmoothScrolling() { diff --git a/src/vs/workbench/contrib/terminalContrib/stickyScroll/browser/terminalStickyScrollOverlay.ts b/src/vs/workbench/contrib/terminalContrib/stickyScroll/browser/terminalStickyScrollOverlay.ts index 22b5188027719..7b3d3de337148 100644 --- a/src/vs/workbench/contrib/terminalContrib/stickyScroll/browser/terminalStickyScrollOverlay.ts +++ b/src/vs/workbench/contrib/terminalContrib/stickyScroll/browser/terminalStickyScrollOverlay.ts @@ -110,14 +110,6 @@ export class TerminalStickyScrollOverlay extends Disposable { })); this._refreshGpuAcceleration(); - this._xtermAddonLoader.importAddon('ligatures').then(LigaturesAddon => { - if (this._store.isDisposed || !this._stickyScrollOverlay) { - return; - } - this._ligaturesAddon = new LigaturesAddon(); - this._stickyScrollOverlay.loadAddon(this._ligaturesAddon); - }); - this._register(configurationService.onDidChangeConfiguration(e => { if (e.affectsConfiguration(TERMINAL_CONFIG_SECTION)) { this._syncOptions(); @@ -402,6 +394,14 @@ export class TerminalStickyScrollOverlay extends Disposable { this._stickyScrollOverlay.open(this._element); + this._xtermAddonLoader.importAddon('ligatures').then(LigaturesAddon => { + if (this._store.isDisposed || !this._stickyScrollOverlay) { + return; + } + this._ligaturesAddon = new LigaturesAddon(); + this._stickyScrollOverlay.loadAddon(this._ligaturesAddon); + }); + // Scroll to the command on click this._register(addStandardDisposableListener(hoverOverlay, 'click', () => { if (this._xterm && this._currentStickyCommand) {