From 96dd021ca4c361a547b12901d8805a9c9c07926f Mon Sep 17 00:00:00 2001 From: Daniel Imms <2193314+Tyriar@users.noreply.github.com> Date: Fri, 9 Jul 2021 07:32:25 -0700 Subject: [PATCH] Support underline in webgl renderer Fixes #2251 --- addons/xterm-addon-webgl/src/atlas/WebglCharAtlas.ts | 7 +++++++ 1 file changed, 7 insertions(+) diff --git a/addons/xterm-addon-webgl/src/atlas/WebglCharAtlas.ts b/addons/xterm-addon-webgl/src/atlas/WebglCharAtlas.ts index 5e1ad195..fb20c1c8 100644 --- a/addons/xterm-addon-webgl/src/atlas/WebglCharAtlas.ts +++ b/addons/xterm-addon-webgl/src/atlas/WebglCharAtlas.ts @@ -338,6 +338,7 @@ export class WebglCharAtlas implements IDisposable { const inverse = !!this._workAttributeData.isInverse(); const dim = !!this._workAttributeData.isDim(); const italic = !!this._workAttributeData.isItalic(); + const underline = !!this._workAttributeData.isUnderline(); let fgColor = this._workAttributeData.getFgColor(); let fgColorMode = this._workAttributeData.getFgColorMode(); let bgColor = this._workAttributeData.getBgColor(); @@ -390,6 +391,12 @@ export class WebglCharAtlas implements IDisposable { // Draw the character this._tmpCtx.fillText(chars, padding, padding + this._config.scaledCharHeight); + if (underline) { + this._tmpCtx.strokeStyle = this._tmpCtx.fillStyle; + this._tmpCtx.moveTo(0, this._config.scaledCharHeight - 1); + this._tmpCtx.lineTo(this._config.scaledCharWidth, this._config.scaledCharHeight - 1); + this._tmpCtx.stroke(); + } this._tmpCtx.restore(); // clear the background from the character to avoid issues with drawing over the previous