nicer underlines & allow underline + strike together

This commit is contained in:
2017-09-09 14:38:03 +02:00
parent 7576cd859a
commit a3567ec338
3 changed files with 608 additions and 7 deletions
+15 -7
View File
@@ -409,16 +409,24 @@ class TermScreen {
ctx.fillText(text, (x + 0.5) * cellWidth, (y + 0.5) * cellHeight);
if (underline || strike) {
let lineY = underline
? y * cellHeight + charSize.height
: (y + 0.5) * cellHeight;
ctx.strokeStyle = inSelection ? SELECTION_FG : this.colors[fg];
ctx.lineWidth = this.window.fontSize / 10;
ctx.lineWidth = this.window.devicePixelRatio==1?1:2;
ctx.lineCap = 'round';
ctx.beginPath();
ctx.moveTo(x * cellWidth, lineY);
ctx.lineTo((x + 1) * cellWidth, lineY);
let lineY;
if (underline) {
lineY = Math.round(y * cellHeight + charSize.height) + 0.5;
ctx.moveTo(x * cellWidth, lineY);
ctx.lineTo((x + 1) * cellWidth, lineY);
}
if (strike) {
lineY = Math.round((y + 0.5) * cellHeight) + 0.5;
ctx.moveTo(x * cellWidth, lineY);
ctx.lineTo((x + 1) * cellWidth, lineY);
}
ctx.stroke()
}
}