Skip to content

Commit

Permalink
Support underline in webgl renderer
Browse files Browse the repository at this point in the history
  • Loading branch information
Tyriar committed Jul 9, 2021
1 parent c8e7edf commit 96dd021
Showing 1 changed file with 7 additions and 0 deletions.
7 changes: 7 additions & 0 deletions addons/xterm-addon-webgl/src/atlas/WebglCharAtlas.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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();
Expand Down Expand Up @@ -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
Expand Down

0 comments on commit 96dd021

Please sign in to comment.