« get me outta code hell

improve & use our own word wrapping code - tui-lib - Pure Node.js library for making visual command-line programs (ala vim, ncdu)
about summary refs log tree commit diff
path: root/ui
diff options
context:
space:
mode:
authorFlorrie <towerofnix@gmail.com>2020-07-16 14:04:25 -0300
committerFlorrie <towerofnix@gmail.com>2020-07-16 14:05:39 -0300
commit7f0579fc6e5771bbcad36591ab54119c4fe66dbd (patch)
tree408c1ee3789645e5e89533a4bf7d9746719175a5 /ui
parentcff17d1f056a73714ff1ba5a735987d140a6b51c (diff)
improve & use our own word wrapping code
Diffstat (limited to 'ui')
-rw-r--r--ui/WrapLabel.js6
1 files changed, 2 insertions, 4 deletions
diff --git a/ui/WrapLabel.js b/ui/WrapLabel.js
index babf462..7036908 100644
--- a/ui/WrapLabel.js
+++ b/ui/WrapLabel.js
@@ -1,5 +1,5 @@
 const ansi = require('../util/ansi')
-const wrap = require('word-wrap')
+const wrap = require('../util/wrap')
 
 const Label = require('./Label')
 
@@ -29,9 +29,7 @@ module.exports = class WrapLabel extends Label {
       return []
     }
 
-    const options = {width: this.w, indent: ''}
-    return wrap(this.text, options).split('\n')
-      .map(l => l.trim())
+    return wrap(this.text, this.w).map(l => l.trim())
   }
 
   get h() {