« 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
path: root/ui/form/Button.js
diff options
context:
space:
mode:
Diffstat (limited to 'ui/form/Button.js')
-rw-r--r--ui/form/Button.js16
1 files changed, 4 insertions, 12 deletions
diff --git a/ui/form/Button.js b/ui/form/Button.js
index 86347a0..cf7262f 100644
--- a/ui/form/Button.js
+++ b/ui/form/Button.js
@@ -3,7 +3,7 @@ const telc = require('../../util/telchars')
 
 const FocusElement = require('./FocusElement')
 
-module.exports = class ButtonInput extends FocusElement {
+module.exports = class Button extends FocusElement {
   // A button.
 
   constructor(text) {
@@ -15,17 +15,9 @@ module.exports = class ButtonInput extends FocusElement {
     this.cursorY = null
   }
 
-  // Setting the text of the button should change the width of the button to
-  // fit the text.
-  //
-  // TODO: Make this happen in fixLayout
-  set text(newText) {
-    this._text = newText
-    this.w = newText.length
-  }
-
-  get text() {
-    return this._text
+  fixLayout() {
+    this.w = this.text.length
+    this.h = 1
   }
 
   drawTo(writable) {