From ec4897ae2a675cecf419ff5505e6df04d13b6aed Mon Sep 17 00:00:00 2001 From: cpsdqs Date: Sun, 10 Sep 2017 02:19:35 +0200 Subject: [PATCH] Add overline style (attr bit 7) --- jssrc/term_screen.js | 10 +++++++++- 1 file changed, 9 insertions(+), 1 deletion(-) diff --git a/jssrc/term_screen.js b/jssrc/term_screen.js index 0444cba..b5b5a28 100644 --- a/jssrc/term_screen.js +++ b/jssrc/term_screen.js @@ -564,17 +564,19 @@ class TermScreen { let underline = false; let blink = false; let strike = false; + let overline = false; if (attrs & (1 << 1)) ctx.globalAlpha = 0.5; if (attrs & (1 << 3)) underline = true; if (attrs & (1 << 4)) blink = true; if (attrs & (1 << 5)) text = TermScreen.alphaToFraktur(text); if (attrs & (1 << 6)) strike = true; + if (attrs & (1 << 7)) overline = true; if (!blink || this.window.blinkStyleOn) { ctx.fillStyle = this.getColor(fg); ctx.fillText(text, (x + 0.5) * cellWidth, (y + 0.5) * cellHeight); - if (underline || strike) { + if (underline || strike || overline) { ctx.strokeStyle = this.getColor(fg); ctx.lineWidth = 1; ctx.lineCap = 'round'; @@ -592,6 +594,12 @@ class TermScreen { ctx.lineTo((x + 1) * cellWidth, lineY); } + if (overline) { + let lineY = Math.round(y * cellHeight) + 0.5; + ctx.moveTo(x * cellWidth, lineY); + ctx.lineTo((x + 1) * cellWidth, lineY); + } + ctx.stroke(); } }