Skip to content

Commit 874799b

Browse files
committed
Support customGlyph in webgl options
1 parent 0fa7421 commit 874799b

File tree

2 files changed

+13
-7
lines changed

2 files changed

+13
-7
lines changed

src/vs/workbench/contrib/terminal/browser/xterm/xtermTerminal.ts

Lines changed: 8 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -120,6 +120,7 @@ export class XtermTerminal extends Disposable implements IXtermTerminal, IDetach
120120
private _searchAddon?: SearchAddonType;
121121
private _unicode11Addon?: Unicode11AddonType;
122122
private _webglAddon?: WebglAddonType;
123+
private _webglAddonCustomGlyphs?: boolean = false;
123124
private _serializeAddon?: SerializeAddonType;
124125
private _imageAddon?: ImageAddonType;
125126
private readonly _ligaturesAddon: MutableDisposable<LigaturesAddonType> = this._register(new MutableDisposable());
@@ -228,7 +229,6 @@ export class XtermTerminal extends Disposable implements IXtermTerminal, IDetach
228229
macOptionIsMeta: config.macOptionIsMeta,
229230
macOptionClickForcesSelection: config.macOptionClickForcesSelection,
230231
rightClickSelectsWord: config.rightClickBehavior === 'selectWord',
231-
fastScrollModifier: 'alt',
232232
fastScrollSensitivity: config.fastScrollSensitivity,
233233
scrollSensitivity: config.mouseWheelScrollSensitivity,
234234
scrollOnEraseInDisplay: true,
@@ -531,7 +531,6 @@ export class XtermTerminal extends Disposable implements IXtermTerminal, IDetach
531531
this.raw.options.macOptionClickForcesSelection = config.macOptionClickForcesSelection;
532532
this.raw.options.rightClickSelectsWord = config.rightClickBehavior === 'selectWord';
533533
this.raw.options.wordSeparator = config.wordSeparators;
534-
this.raw.options.customGlyphs = config.customGlyphs;
535534
this.raw.options.ignoreBracketedPasteMode = config.ignoreBracketedPasteMode;
536535
this.raw.options.rescaleOverlappingGlyphs = config.rescaleOverlappingGlyphs;
537536

@@ -790,12 +789,16 @@ export class XtermTerminal extends Disposable implements IXtermTerminal, IDetach
790789
}
791790

792791
private async _enableWebglRenderer(): Promise<void> {
793-
if (!this.raw.element || this._webglAddon) {
792+
// Currently webgl options can only be specified on addon creation
793+
if (!this.raw.element || this._webglAddon && this._webglAddonCustomGlyphs === this._terminalConfigurationService.config.customGlyphs) {
794794
return;
795795
}
796+
this._webglAddonCustomGlyphs = this._terminalConfigurationService.config.customGlyphs;
796797

797798
const Addon = await this._xtermAddonLoader.importAddon('webgl');
798-
this._webglAddon = new Addon();
799+
this._webglAddon = new Addon({
800+
customGlyphs: this._terminalConfigurationService.config.customGlyphs
801+
});
799802
try {
800803
this.raw.loadAddon(this._webglAddon);
801804
this._logService.trace('Webgl was loaded');
@@ -885,6 +888,7 @@ export class XtermTerminal extends Disposable implements IXtermTerminal, IDetach
885888
// ignore
886889
}
887890
this._webglAddon = undefined;
891+
this._webglAddonCustomGlyphs = undefined;
888892
this._refreshImageAddon();
889893
// WebGL renderer cell dimensions differ from the DOM renderer, make sure the terminal
890894
// gets resized after the webgl addon is disposed

src/vs/workbench/contrib/terminalContrib/stickyScroll/browser/terminalStickyScrollOverlay.ts

Lines changed: 5 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -51,6 +51,7 @@ export class TerminalStickyScrollOverlay extends Disposable {
5151
private readonly _xtermAddonLoader = new XtermAddonImporter();
5252
private _serializeAddon?: SerializeAddonType;
5353
private _webglAddon?: WebglAddonType;
54+
private _webglAddonCustomGlyphs?: boolean;
5455
private _ligaturesAddon?: LigaturesAddonType;
5556

5657
private _element?: HTMLElement;
@@ -491,18 +492,19 @@ export class TerminalStickyScrollOverlay extends Disposable {
491492
drawBoldTextInBrightColors: o.drawBoldTextInBrightColors,
492493
minimumContrastRatio: o.minimumContrastRatio,
493494
tabStopWidth: o.tabStopWidth,
494-
customGlyphs: o.customGlyphs,
495495
};
496496
}
497497

498498
@throttle(0)
499499
private async _refreshGpuAcceleration() {
500-
if (this._shouldLoadWebgl() && !this._webglAddon) {
500+
if (this._shouldLoadWebgl() && (!this._webglAddon || this._webglAddonCustomGlyphs !== this._terminalConfigurationService.config.customGlyphs)) {
501501
const WebglAddon = await this._xtermAddonLoader.importAddon('webgl');
502502
if (this._store.isDisposed) {
503503
return;
504504
}
505-
this._webglAddon = this._register(new WebglAddon());
505+
this._webglAddon = this._register(new WebglAddon({
506+
customGlyphs: this._terminalConfigurationService.config.customGlyphs
507+
}));
506508
this._stickyScrollOverlay?.loadAddon(this._webglAddon);
507509
} else if (!this._shouldLoadWebgl() && this._webglAddon) {
508510
this._webglAddon.dispose();

0 commit comments

Comments
 (0)