From d5f6bf2dfa36b66f534db6aa0f03a1d07996a1b4 Mon Sep 17 00:00:00 2001 From: cpsdqs Date: Mon, 11 Sep 2017 07:02:26 +0200 Subject: [PATCH] Fix invisible cursors --- jssrc/term_screen.js | 11 ++++++----- 1 file changed, 6 insertions(+), 5 deletions(-) diff --git a/jssrc/term_screen.js b/jssrc/term_screen.js index e51b8a3..185d1dd 100644 --- a/jssrc/term_screen.js +++ b/jssrc/term_screen.js @@ -622,7 +622,7 @@ class TermScreen { ctx.fillRect(x * cellWidth, y * cellHeight, Math.ceil(cellWidth), Math.ceil(cellHeight)) } - drawCell ({ x, y, charSize, cellWidth, cellHeight, text, fg, bg, attrs }) { + drawCell ({ x, y, charSize, cellWidth, cellHeight, text, fg, attrs }) { if (!text) return const ctx = this.ctx @@ -851,7 +851,7 @@ class TermScreen { if (redrawMap.get(cell)) { this.drawCell({ - x, y, charSize, cellWidth, cellHeight, text, fg, bg, attrs + x, y, charSize, cellWidth, cellHeight, text, fg, attrs }) this.drawnScreen[cell] = text @@ -888,13 +888,14 @@ class TermScreen { ctx.clip() // swap foreground/background - fg = this.screenBG[cell] - bg = this.screenFG[cell] + ;[fg, bg] = [bg, fg] + // HACK: ensure cursor is visible if (fg === bg) bg = fg === 0 ? 7 : 0 + this.drawCellBackground({ x, y, cellWidth, cellHeight, bg }) this.drawCell({ - x, y, charSize, cellWidth, cellHeight, text, fg, bg, attrs + x, y, charSize, cellWidth, cellHeight, text, fg, attrs }) ctx.restore() }