« get me outta code hell

Stop tracking mouse on cleanCursor() - 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:
authorFlorrie <towerofnix@gmail.com>2018-12-08 03:18:50 -0400
committerFlorrie <towerofnix@gmail.com>2018-12-08 03:18:50 -0400
commit99d2ed5b2f8bb39fa2517efd5a68dbb2b27b3121 (patch)
tree89bf164b48c88be1c90fe4aaaa1ccdbe81a8e79d /util/ansi.js
parent9ab92766dd225cdf6db0e465057f8f7fddddac28 (diff)
Stop tracking mouse on cleanCursor()
This way when a program is exited, the mouse will go back to normal (so
you can scroll the terminal log, etc).
Diffstat (limited to 'util/ansi.js')
-rw-r--r--util/ansi.js8
1 files changed, 7 insertions, 1 deletions
diff --git a/util/ansi.js b/util/ansi.js
index 860a4fa..e7f7642 100644
--- a/util/ansi.js
+++ b/util/ansi.js
@@ -48,7 +48,9 @@ const ansi = {
   cleanCursor() {
     // A combination of codes that generally cleans up the cursor.
 
-    return ansi.resetAttributes() + ansi.showCursor()
+    return ansi.resetAttributes() +
+      ansi.stopTrackingMouse() +
+      ansi.showCursor()
   },
 
   hideCursor() {
@@ -108,6 +110,10 @@ const ansi = {
     return `${ESC}[?1000h`
   },
 
+  stopTrackingMouse() {
+    return `${ESC}[?1000l`
+  },
+
   requestCursorPosition() {
     // Requests the position of the cursor.
     // Expect a stdin-result '\ESC[l;cR', where l is the line number (1-based),