From 77885ed63d2b88004e0272845f9a92a4e08308e0 Mon Sep 17 00:00:00 2001 From: Daniel Imms <2193314+Tyriar@users.noreply.github.com> Date: Mon, 4 Nov 2024 09:47:26 -0800 Subject: [PATCH] Set liga font feature when ligatures is enabled Fixes #5207 --- addons/addon-ligatures/src/LigaturesAddon.ts | 7 +++++++ 1 file changed, 7 insertions(+) diff --git a/addons/addon-ligatures/src/LigaturesAddon.ts b/addons/addon-ligatures/src/LigaturesAddon.ts index cb589303..47fbc323 100644 --- a/addons/addon-ligatures/src/LigaturesAddon.ts +++ b/addons/addon-ligatures/src/LigaturesAddon.ts @@ -31,8 +31,12 @@ export class LigaturesAddon implements ITerminalAddon , ILigaturesApi { } public activate(terminal: Terminal): void { + if (!terminal.element) { + throw new Error('Cannot activate LigaturesAddon before open is called'); + } this._terminal = terminal; this._characterJoinerId = enableLigatures(terminal, this._fallbackLigatures); + terminal.element.style.fontFeatureSettings = '"liga" on, "calt" on'; } public dispose(): void { @@ -40,5 +44,8 @@ export class LigaturesAddon implements ITerminalAddon , ILigaturesApi { this._terminal?.deregisterCharacterJoiner(this._characterJoinerId); this._characterJoinerId = undefined; } + if (this._terminal?.element) { + this._terminal.element.style.fontFeatureSettings = ''; + } } }