diff --git a/src/renderer/BaseRenderLayer.ts b/src/renderer/BaseRenderLayer.ts index 858f15b86..523edbda0 100644 --- a/src/renderer/BaseRenderLayer.ts +++ b/src/renderer/BaseRenderLayer.ts @@ -82,7 +82,7 @@ export abstract class BaseRenderLayer implements IRenderLayer { this._ctx.clearRect(startCol * this.scaledCharWidth, startRow * this.scaledCharHeight, colWidth * this.scaledCharWidth, colHeight * this.scaledCharHeight); } - protected drawChar(terminal: ITerminal, char: string, code: number, x: number, y: number, fg: number): void { + protected drawChar(terminal: ITerminal, char: string, code: number, x: number, y: number, fg: number, underline: boolean = false): void { let colorIndex = 0; if (fg < 256) { colorIndex = fg + 1; @@ -113,7 +113,6 @@ export abstract class BaseRenderLayer implements IRenderLayer { this._ctx.fillStyle = this.colors.foreground; } - // TODO: Do we care about width for rendering wide chars? this._ctx.fillText(char, x * scaledCharWidth, y * scaledCharHeight); this._ctx.restore(); } diff --git a/src/renderer/ForegroundRenderLayer.ts b/src/renderer/ForegroundRenderLayer.ts index 7d1cec1fd..30f68f4c5 100644 --- a/src/renderer/ForegroundRenderLayer.ts +++ b/src/renderer/ForegroundRenderLayer.ts @@ -88,7 +88,20 @@ export class ForegroundRenderLayer extends BaseRenderLayer { } } + if (flags & FLAGS.UNDERLINE) { + if (fg === INVERTED_DEFAULT_COLOR) { + this._ctx.fillStyle = this.colors.background; + } else if (fg < 256) { + // 256 color support + this._ctx.fillStyle = this.colors.ansi[fg]; + } else { + this._ctx.fillStyle = this.colors.foreground; + } + this.fillBottomLineAtCell(x, y); + } + this.drawChar(terminal, char, code, x, y, fg); + this._ctx.restore(); } }