From 1b188c7cda2a1002586e795e315558f1326b7246 Mon Sep 17 00:00:00 2001 From: Cursor Agent Date: Fri, 29 May 2026 11:49:08 +0000 Subject: [PATCH] fix(terminal): track ligatures addon config for change detection Store ILigatureOptions in _ligaturesAddonConfig when the addon is created, clear it when the addon is disposed, and compare against the ILigatureOptions shape passed to the addon (not the full fontLigatures object, which includes enabled). Co-authored-by: Daniel Imms --- .../terminal/browser/xterm/xtermTerminal.ts | 16 ++++++++++------ 1 file changed, 10 insertions(+), 6 deletions(-) diff --git a/src/vs/workbench/contrib/terminal/browser/xterm/xtermTerminal.ts b/src/vs/workbench/contrib/terminal/browser/xterm/xtermTerminal.ts index 34bae81f28ee8e..743bbe76d587bb 100644 --- a/src/vs/workbench/contrib/terminal/browser/xterm/xtermTerminal.ts +++ b/src/vs/workbench/contrib/terminal/browser/xterm/xtermTerminal.ts @@ -139,7 +139,7 @@ export class XtermTerminal extends Disposable implements IXtermTerminal, IDetach private _serializeAddon?: SerializeAddonType; private _imageAddon?: ImageAddonType; private readonly _ligaturesAddon: MutableDisposable = this._register(new MutableDisposable()); - private readonly _ligaturesAddonConfig?: ILigatureOptions; + private _ligaturesAddonConfig?: ILigatureOptions; private readonly _attachedDisposables = this._register(new DisposableStore()); private readonly _anyTerminalFocusContextKey: IContextKey; @@ -895,18 +895,21 @@ export class XtermTerminal extends Disposable implements IXtermTerminal, IDetach const ligaturesConfig = this._terminalConfigurationService.config.fontLigatures; let shouldRecreateWebglRenderer = false; if (ligaturesConfig?.enabled) { - if (this._ligaturesAddon.value && !equals(ligaturesConfig, this._ligaturesAddonConfig)) { + const ligatureOptions: ILigatureOptions = { + fontFeatureSettings: ligaturesConfig.featureSettings, + fallbackLigatures: ligaturesConfig.fallbackLigatures, + }; + if (this._ligaturesAddon.value && !equals(ligatureOptions, this._ligaturesAddonConfig)) { this._ligaturesAddon.clear(); + this._ligaturesAddonConfig = undefined; } if (!this._ligaturesAddon.value) { const LigaturesAddon = await this._xtermAddonLoader.importAddon('ligatures'); if (this._store.isDisposed) { return; } - this._ligaturesAddon.value = this._instantiationService.createInstance(LigaturesAddon, { - fontFeatureSettings: ligaturesConfig.featureSettings, - fallbackLigatures: ligaturesConfig.fallbackLigatures, - }); + this._ligaturesAddon.value = this._instantiationService.createInstance(LigaturesAddon, ligatureOptions); + this._ligaturesAddonConfig = ligatureOptions; this.raw.loadAddon(this._ligaturesAddon.value); shouldRecreateWebglRenderer = true; } @@ -915,6 +918,7 @@ export class XtermTerminal extends Disposable implements IXtermTerminal, IDetach return; } this._ligaturesAddon.clear(); + this._ligaturesAddonConfig = undefined; shouldRecreateWebglRenderer = true; }