Add powerline triangles

box-drawing
cpsdqs 7 years ago
parent 342433be53
commit 65eb8b1830
Signed by untrusted user: cpsdqs
GPG Key ID: 3F59586BB7448DD1
  1. 24
      js/term/screen_renderer.js

@ -320,6 +320,30 @@ module.exports = class ScreenRenderer {
} }
ctx.fill() ctx.fill()
} else if (codePoint >= 0xE0B0 && codePoint <= 0xE0B3) {
// powerline symbols, except branch, line, and lock. Basically, just the triangles
ctx.beginPath()
if (codePoint === 0xE0B0 || codePoint === 0xE0B1) {
// right-pointing triangle
ctx.moveTo(screenX, screenY)
ctx.lineTo(screenX + cellWidth, screenY + cellHeight / 2)
ctx.lineTo(screenX, screenY + cellHeight)
} else if (codePoint === 0xE0B2 || codePoint === 0xE0B3) {
// left-pointing triangle
ctx.moveTo(screenX + cellWidth, screenY)
ctx.lineTo(screenX, screenY + cellHeight / 2)
ctx.lineTo(screenX + cellWidth, screenY + cellHeight)
}
if (codePoint % 2 === 0) {
// triangle
ctx.fill()
} else {
// chevron
ctx.strokeStyle = ctx.fillStyle
ctx.stroke()
}
} else { } else {
// Draw other characters using the text renderer // Draw other characters using the text renderer
ctx.fillText(text, screenX + 0.5 * cellWidth, screenY + 0.5 * cellHeight) ctx.fillText(text, screenX + 0.5 * cellWidth, screenY + 0.5 * cellHeight)

Loading…
Cancel
Save