« get me outta code hell

Make label text a draw dependency - 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:
authorFlorrie <towerofnix@gmail.com>2019-09-18 16:05:11 -0300
committerFlorrie <towerofnix@gmail.com>2019-09-18 16:05:11 -0300
commite4ae17895cd673bdc8a8a2a060b835b0492daeb1 (patch)
treea9dfe0d85928c0e12a80d214d162507126244bf9
parent49eb24099f0a6088976972df5ecb7c927c78a110 (diff)
Make label text a draw dependency
This makes the screen be automatically redrawn whenever a label's text
is updated.
-rw-r--r--ui/Label.js5
1 files changed, 3 insertions, 2 deletions
diff --git a/ui/Label.js b/ui/Label.js
index e320574..d1b3098 100644
--- a/ui/Label.js
+++ b/ui/Label.js
@@ -36,11 +36,12 @@ module.exports = class Label extends DisplayElement {
   }
 
   set text(newText) {
-    this._text = newText
+    const ret = this.setDep('text', newText)
     this.fixLayout()
+    return ret
   }
 
   get text() {
-    return this._text
+    return this.getDep('text')
   }
 }