« get me outta code hell

(!!) Only render when draw-dependency props change - 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
diff options
context:
space:
mode:
authorFlorrie <towerofnix@gmail.com>2019-09-15 16:55:53 -0300
committerFlorrie <towerofnix@gmail.com>2019-09-15 17:09:31 -0300
commit3f76094c554c23ee3519f41458a04d348f4f75a3 (patch)
tree5b87c588651b52aec6136e651e73d9f1d747c638 /ui/form
parent878e55e7c2a203d89fb1dad83ba6d6d8751b521a (diff)
(!!) Only render when draw-dependency props change
This is a very large change and probably breaks most applications not
built to work with it. (Obviously, I'm not really being that responsible
with this sort of thing.) I've tested with mtui and it works fine, but
some elements may need tweaks before being 100% adjusted to the new
scheduled-render system we're using with this commit. Also, any elements
which have custom draw behavior will likely need updating so that they
appropriately schedule renders.
Diffstat (limited to 'ui/form')
-rw-r--r--ui/form/Form.js3
-rw-r--r--ui/form/TextInput.js3
2 files changed, 6 insertions, 0 deletions
diff --git a/ui/form/Form.js b/ui/form/Form.js
index 3c59cf5..74a1065 100644
--- a/ui/form/Form.js
+++ b/ui/form/Form.js
@@ -122,4 +122,7 @@ module.exports = class Form extends FocusElement {
       this.updateSelectedElement()
     }
   }
+
+  get curIndex() { return this.getDep('curIndex') }
+  set curIndex(v) { return this.setDep('curIndex', v) }
 }
diff --git a/ui/form/TextInput.js b/ui/form/TextInput.js
index 08bbbb6..78d3b6d 100644
--- a/ui/form/TextInput.js
+++ b/ui/form/TextInput.js
@@ -139,4 +139,7 @@ module.exports = class TextInput extends FocusElement {
       this.scrollChars--
     }
   }
+
+  get value() { return this.getDep('value') }
+  set value(v) { return this.setDep('value', v) }
 }