« get me outta code hell

Merge remote-tracking branch 'notabug/master' - 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/presentation/WrapLabel.js
diff options
context:
space:
mode:
author(quasar) nebula <qznebula@protonmail.com>2023-05-13 13:20:59 -0300
committer(quasar) nebula <qznebula@protonmail.com>2023-05-13 13:20:59 -0300
commit34b7ff22766bae0e4b1b3121bd63d037c27285c7 (patch)
treef2f66a17c67bdf9be0b1576b28ffd0cf107b483c /ui/presentation/WrapLabel.js
parent684e369c7b01b4c69995fc604ef33919077ffdf5 (diff)
parenta37d6be77261b2aae25c4235dcb38dd7b1bb60b1 (diff)
Merge remote-tracking branch 'notabug/master'
Diffstat (limited to 'ui/presentation/WrapLabel.js')
-rw-r--r--ui/presentation/WrapLabel.js8
1 files changed, 2 insertions, 6 deletions
diff --git a/ui/presentation/WrapLabel.js b/ui/presentation/WrapLabel.js
index 0ecc777..eae8960 100644
--- a/ui/presentation/WrapLabel.js
+++ b/ui/presentation/WrapLabel.js
@@ -1,5 +1,3 @@
-import wrap from 'word-wrap'
-
 import * as ansi from 'tui-lib/util/ansi'
 
 import Label from './Label.js'
@@ -21,7 +19,7 @@ export default class WrapLabel extends Label {
     const lines = this.getWrappedLines()
     for (let i = 0; i < lines.length; i++) {
       writable.write(ansi.moveCursor(this.absTop + i, this.absLeft))
-      writable.write(lines[i])
+      writable.write(this.processFormatting(lines[i]))
     }
   }
 
@@ -30,9 +28,7 @@ export default class WrapLabel extends Label {
       return []
     }
 
-    const options = {width: this.w, indent: ''}
-    return wrap(this.text, options).split('\n')
-      .map(l => l.trim())
+    return ansi.wrapToColumns(this.text, this.w - 1).map(l => l.trim())
   }
 
   get h() {