« get me outta code hell

Improve cursor display - tui-lib - Pure Node.js library for making visual command-line programs (ala vim, ncdu)
about summary refs log tree commit diff
path: root/util/ansi.js
diff options
context:
space:
mode:
authorliam4 <towerofnix@gmail.com>2017-07-03 21:13:50 -0300
committerliam4 <towerofnix@gmail.com>2017-07-03 21:13:50 -0300
commitb087c428ba492715626a7875185f9ba18fb30b3e (patch)
treec7ca597804b9cb3b13e43782d95b0a24fb83a73e /util/ansi.js
parent930d61b9f067346f467d4d84015088f57c54da56 (diff)
Improve cursor display
- Whether the cursor is displayed or not is now based on the
  cursorVisible property rather than whether cursorX and cursorY
  are set or not.
- The actual shell cursor is now invisible... this is objectively
  an act of Evil, though! This doesn't look like too hard to
  fix, thankfully.
- A new cleanCursor function has been added to ansi.js.
Diffstat (limited to 'util/ansi.js')
-rw-r--r--util/ansi.js6
1 files changed, 6 insertions, 0 deletions
diff --git a/util/ansi.js b/util/ansi.js
index 0e6e3fe..0ee1bc1 100644
--- a/util/ansi.js
+++ b/util/ansi.js
@@ -43,6 +43,12 @@ const ansi = {
     return `${ESC}[${line + 1};${col + 1}H`
   },
 
+  cleanCursor() {
+    // A combination of codes that generally cleans up the cursor.
+
+    return ansi.resetAttributes() + ansi.showCursor()
+  },
+
   hideCursor() {
     // Makes the cursor invisible.