« get me outta code hell

Form.selectInput function - 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/Form.js
diff options
context:
space:
mode:
authorFlorrie <towerofnix@gmail.com>2018-06-04 23:40:50 -0300
committerFlorrie <towerofnix@gmail.com>2018-06-04 23:40:50 -0300
commit62348f48fbe2da7ab2af0e3ea71b0fbe7380b31e (patch)
tree3ac69e6034dcfe0263814e99b818992dba2f5424 /ui/form/Form.js
parentc42add3c9edb6446a759ae4f5a2b3e81cf56f4f5 (diff)
Form.selectInput function
Diffstat (limited to 'ui/form/Form.js')
-rw-r--r--ui/form/Form.js7
1 files changed, 7 insertions, 0 deletions
diff --git a/ui/form/Form.js b/ui/form/Form.js
index e5d756a..f1734ac 100644
--- a/ui/form/Form.js
+++ b/ui/form/Form.js
@@ -36,6 +36,13 @@ module.exports = class Form extends FocusElement {
     }
   }
 
+  selectInput(input) {
+    if (this.inputs.includes(input)) {
+      this.curIndex = this.inputs.indexOf(input)
+      this.updateSelectedElement()
+    }
+  }
+
   keyPressed(keyBuf) {
     // Don't do anything if captureTab is set to false. This is handy for
     // nested forms.