Skip to content
Merged
Show file tree
Hide file tree
Changes from 3 commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 3 additions & 0 deletions addons/xterm-addon-canvas/src/BaseRenderLayer.ts
Original file line number Diff line number Diff line change
Expand Up @@ -373,6 +373,9 @@ export abstract class BaseRenderLayer extends Disposable implements IRenderLayer
} else {
glyph = this._charAtlas.getRasterizedGlyph(cell.getCode() || WHITESPACE_CELL_CODE, this._cellColorResolver.result.bg, this._cellColorResolver.result.fg, this._cellColorResolver.result.ext);
}
if (!glyph.size.x || !glyph.size.y) {
return;
}
Comment thread
jerch marked this conversation as resolved.
this._ctx.save();
this._clipRow(y);
// Draw the image, use the bitmap if it's available
Expand Down
6 changes: 6 additions & 0 deletions addons/xterm-addon-canvas/src/TextRenderLayer.ts
Original file line number Diff line number Diff line change
Expand Up @@ -95,6 +95,12 @@ export class TextRenderLayer extends BaseRenderLayer {
continue;
}

// exit early for NULL and SP
const code = cell.getCode();
if (code === 0 || code === 32) {
continue;
}

// Process any joined character ranges as needed. Because of how the
// ranges are produced, we know that they are valid for the characters
// and attributes of our input.
Expand Down
24 changes: 12 additions & 12 deletions demo/client.ts
Original file line number Diff line number Diff line change
Expand Up @@ -273,22 +273,22 @@ function createTerminal(): void {
socketURL = protocol + location.hostname + ((location.port) ? (':' + location.port) : '') + '/terminals/';

addons.fit.instance!.fit();
typedTerm.loadAddon(addons.webgl.instance);
setTimeout(() => {
if (addons.webgl.instance !== undefined) {
setTextureAtlas(addons.webgl.instance.textureAtlas);
addons.webgl.instance.onChangeTextureAtlas(e => setTextureAtlas(e));
addons.webgl.instance.onAddTextureAtlasCanvas(e => appendTextureAtlas(e));
addons.webgl.instance.onRemoveTextureAtlasCanvas(e => removeTextureAtlas(e));
}
}, 0);
Comment thread
jerch marked this conversation as resolved.

try { // try-catch to allow the demo to load if webgl is not supported
// try to start with webgl renderer (might throw on older safari/webkit)
try {
typedTerm.loadAddon(addons.webgl.instance);
term.open(terminalContainer);
}
catch {
setTextureAtlas(addons.webgl.instance.textureAtlas);
addons.webgl.instance.onChangeTextureAtlas(e => setTextureAtlas(e));
addons.webgl.instance.onAddTextureAtlasCanvas(e => appendTextureAtlas(e));
addons.webgl.instance.onRemoveTextureAtlasCanvas(e => removeTextureAtlas(e));
} catch (e) {
console.log(e);
addons.webgl.instance.dispose();
addons.webgl.instance = undefined;
term.open(terminalContainer);
}

term.focus();

addDomListener(paddingElement, 'change', setPadding);
Expand Down