From 3f1ff3586fb5db8ab99fdab6e5c5a476cc129cba Mon Sep 17 00:00:00 2001 From: liam4 Date: Mon, 3 Jul 2017 21:18:25 -0300 Subject: Fix the Act of Evil related to real-cursor visibility --- ui/Root.js | 28 ++++++++++++++++++---------- 1 file changed, 18 insertions(+), 10 deletions(-) (limited to 'ui/Root.js') diff --git a/ui/Root.js b/ui/Root.js index fc494a7..22c2c97 100644 --- a/ui/Root.js +++ b/ui/Root.js @@ -49,17 +49,25 @@ module.exports = class Root extends DisplayElement { didRenderTo(writable) { // Render the cursor, based on the cursorX and cursorY of the currently // selected element. - if ( - this.selected && this.selected.cursorVisible && - (Date.now() - this.cursorBlinkOffset) % 1000 < 500 - ) { - writable.write(ansi.moveCursor( - this.selected.absCursorY, this.selected.absCursorX)) - writable.write(ansi.invert()) - writable.write('I') - writable.write(ansi.resetAttributes()) + if (this.selected && this.selected.cursorVisible) { + if ((Date.now() - this.cursorBlinkOffset) % 1000 < 500) { + writable.write( + ansi.moveCursor(this.selected.absCursorY, this.selected.absCursorX) + ) + writable.write(ansi.invert()) + writable.write('I') + writable.write(ansi.resetAttributes()) + } + + writable.write(ansi.showCursor()) + writable.write( + ansi.moveCursor(this.selected.absCursorY, this.selected.absCursorX) + ) + } else { + writable.write(ansi.hideCursor()) } - writable.write(ansi.hideCursor()) + + if (this.selected && this.selected.cursorVisible) {} } cursorMoved() { -- cgit 1.3.0-6-gf8a5