« get me outta code hell

tui-lib - Pure Node.js library for making visual command-line programs (ala vim, ncdu)
about summary refs log tree commit diff
diff options
context:
space:
mode:
-rw-r--r--util/ansi.js6
1 files changed, 6 insertions, 0 deletions
diff --git a/util/ansi.js b/util/ansi.js
index f0d7bf7..f976c12 100644
--- a/util/ansi.js
+++ b/util/ansi.js
@@ -113,6 +113,12 @@ const ansi = {
     return `${ESC}[6n`
   },
 
+  measureColumns(text) {
+    // Returns the number of columns the given text takes.
+
+    return wcwidth(text)
+  },
+
   isANSICommand(buffer, code = null) {
     return (
       buffer[0] === 0x1b && buffer[1] === 0x5b &&