diff --git a/addons/xterm-addon-webgl/src/GlyphRenderer.ts b/addons/xterm-addon-webgl/src/GlyphRenderer.ts index e679232c..6eff4ced 100644 --- a/addons/xterm-addon-webgl/src/GlyphRenderer.ts +++ b/addons/xterm-addon-webgl/src/GlyphRenderer.ts @@ -185,17 +185,15 @@ export class GlyphRenderer extends Disposable { return; } - let rasterizedGlyph: IRasterizedGlyph; if (!this._atlas) { return; } // Get the glyph + let rasterizedGlyph: IRasterizedGlyph; if (chars && chars.length > 1) { - // TODO: Use actual ext rasterizedGlyph = this._atlas.getRasterizedGlyphCombinedChar(chars, bg, fg, ext); } else { - // TODO: Use actual ext rasterizedGlyph = this._atlas.getRasterizedGlyph(code, bg, fg, ext); } diff --git a/addons/xterm-addon-webgl/src/RenderModel.ts b/addons/xterm-addon-webgl/src/RenderModel.ts index b93e1e85..2969a6d1 100644 --- a/addons/xterm-addon-webgl/src/RenderModel.ts +++ b/addons/xterm-addon-webgl/src/RenderModel.ts @@ -6,9 +6,10 @@ import { IRenderModel, ISelectionRenderModel } from './Types'; import { fill } from 'common/TypedArrayUtils'; -export const RENDER_MODEL_INDICIES_PER_CELL = 3; +export const RENDER_MODEL_INDICIES_PER_CELL = 4; export const RENDER_MODEL_BG_OFFSET = 1; export const RENDER_MODEL_FG_OFFSET = 2; +export const RENDER_MODEL_EXT_OFFSET = 3; export const COMBINED_CHAR_BIT_MASK = 0x80000000; diff --git a/addons/xterm-addon-webgl/src/WebglRenderer.ts b/addons/xterm-addon-webgl/src/WebglRenderer.ts index 7790b8c2..904e8d5a 100644 --- a/addons/xterm-addon-webgl/src/WebglRenderer.ts +++ b/addons/xterm-addon-webgl/src/WebglRenderer.ts @@ -10,9 +10,9 @@ import { acquireCharAtlas } from './atlas/CharAtlasCache'; import { WebglCharAtlas } from './atlas/WebglCharAtlas'; import { RectangleRenderer } from './RectangleRenderer'; import { IWebGL2RenderingContext } from './Types'; -import { RenderModel, COMBINED_CHAR_BIT_MASK, RENDER_MODEL_BG_OFFSET, RENDER_MODEL_FG_OFFSET, RENDER_MODEL_INDICIES_PER_CELL } from './RenderModel'; +import { RenderModel, COMBINED_CHAR_BIT_MASK, RENDER_MODEL_BG_OFFSET, RENDER_MODEL_FG_OFFSET, RENDER_MODEL_EXT_OFFSET, RENDER_MODEL_INDICIES_PER_CELL } from './RenderModel'; import { Disposable } from 'common/Lifecycle'; -import { Attributes, Content, FgFlags, NULL_CELL_CHAR, NULL_CELL_CODE } from 'common/buffer/Constants'; +import { Attributes, BgFlags, Content, FgFlags, NULL_CELL_CHAR, NULL_CELL_CODE } from 'common/buffer/Constants'; import { Terminal, IEvent } from 'xterm'; import { IRenderLayer } from './renderLayer/Types'; import { IRenderDimensions, IRenderer, IRequestRedrawEvent } from 'browser/renderer/Types'; @@ -343,7 +343,8 @@ export class WebglRenderer extends Disposable implements IRenderer { // Nothing has changed, no updates needed if (this._model.cells[i] === code && this._model.cells[i + RENDER_MODEL_BG_OFFSET] === this._workColors.bg && - this._model.cells[i + RENDER_MODEL_FG_OFFSET] === this._workColors.fg) { + this._model.cells[i + RENDER_MODEL_FG_OFFSET] === this._workColors.fg && + this._model.cells[i + RENDER_MODEL_EXT_OFFSET] === this._workColors.ext) { continue; } @@ -356,6 +357,7 @@ export class WebglRenderer extends Disposable implements IRenderer { this._model.cells[i] = code; this._model.cells[i + RENDER_MODEL_BG_OFFSET] = this._workColors.bg; this._model.cells[i + RENDER_MODEL_FG_OFFSET] = this._workColors.fg; + this._model.cells[i + RENDER_MODEL_EXT_OFFSET] = this._workColors.ext; this._glyphRenderer.updateCell(x, y, code, this._workColors.bg, this._workColors.fg, this._workColors.ext, chars, lastBg); @@ -370,6 +372,7 @@ export class WebglRenderer extends Disposable implements IRenderer { this._model.cells[j] = NULL_CELL_CODE; this._model.cells[j + RENDER_MODEL_BG_OFFSET] = this._workColors.bg; this._model.cells[j + RENDER_MODEL_FG_OFFSET] = this._workColors.fg; + this._model.cells[j + RENDER_MODEL_EXT_OFFSET] = this._workColors.ext; } } } @@ -384,8 +387,7 @@ export class WebglRenderer extends Disposable implements IRenderer { private _loadColorsForCell(x: number, y: number): void { this._workColors.bg = this._workCell.bg; this._workColors.fg = this._workCell.fg; - this._workColors.ext = this._workCell.extended.ext; - + this._workColors.ext = this._workCell.bg & BgFlags.HAS_EXTENDED ? this._workCell.extended.ext : 0; // Get any foreground/background overrides, this happens on the model to avoid spreading // override logic throughout the different sub-renderers let bgOverride: number | undefined; diff --git a/addons/xterm-addon-webgl/src/atlas/WebglCharAtlas.ts b/addons/xterm-addon-webgl/src/atlas/WebglCharAtlas.ts index 1e7d7eda..8638eec1 100644 --- a/addons/xterm-addon-webgl/src/atlas/WebglCharAtlas.ts +++ b/addons/xterm-addon-webgl/src/atlas/WebglCharAtlas.ts @@ -160,7 +160,7 @@ export class WebglCharAtlas implements IDisposable { let rasterizedGlyphSet = cacheMap[key]; if (!rasterizedGlyphSet) { rasterizedGlyphSet = {}; - this._cacheMapCombined[key] = rasterizedGlyphSet; + cacheMap[key] = rasterizedGlyphSet; } let rasterizedGlyphSetBg = rasterizedGlyphSet[bg]; diff --git a/demo/client.ts b/demo/client.ts index 4098c775..f8fa7eb5 100644 --- a/demo/client.ts +++ b/demo/client.ts @@ -210,6 +210,9 @@ function createTerminal(): void { term.open(terminalContainer); addons.fit.instance!.fit(); typedTerm.loadAddon(addons.webgl.instance); + setTimeout(() => { + document.body.appendChild(addons.webgl.instance.textureAtlas); + }, 0); term.focus(); addDomListener(paddingElement, 'change', setPadding);