Fix invisible cursors

cpsdqs/unified-input
cpsdqs 7 years ago
parent a78db76327
commit d5f6bf2dfa
Signed by untrusted user: cpsdqs
GPG Key ID: 3F59586BB7448DD1
  1. 11
      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()
}

Loading…
Cancel
Save