« 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
diff options
context:
space:
mode:
-rw-r--r--ui/form/Form.js15
1 files changed, 15 insertions, 0 deletions
diff --git a/ui/form/Form.js b/ui/form/Form.js
index 74a1065..451baa4 100644
--- a/ui/form/Form.js
+++ b/ui/form/Form.js
@@ -117,6 +117,21 @@ module.exports = class Form extends FocusElement {
     }
   }
 
+  lastInput(selectForm = true) {
+    this.curIndex = this.inputs.length - 1
+
+    // TODO: See previousInput
+    if (!this.inputs[this.curIndex].selectable) {
+      this.previousInput()
+    }
+
+    if (selectForm || (
+      this.root.isChildOrSelfSelected && this.root.isChildOrSelfSelected(this)
+    )) {
+      this.updateSelectedElement()
+    }
+  }
+
   selected() {
     if (this.root.selectedElement === this) {
       this.updateSelectedElement()