« get me outta code hell

Remove page up/down controls from ListScrollForm - 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>2018-06-07 22:15:49 -0300
committerFlorrie <towerofnix@gmail.com>2018-06-07 22:15:49 -0300
commitd7c5631264c48e07a8383fb46b453b2b4d8a3637 (patch)
tree74c5a8577583260b46a0e7e9d5e2989ca11e2d10 /ui/form
parent62348f48fbe2da7ab2af0e3ea71b0fbe7380b31e (diff)
Remove page up/down controls from ListScrollForm
These are unfortunately based on the assumption that every input is
exactly one character tall, and definitely don't work with horizontal
scrollers, so I had to remove them.
Diffstat (limited to 'ui/form')
-rw-r--r--ui/form/ListScrollForm.js28
1 files changed, 0 insertions, 28 deletions
diff --git a/ui/form/ListScrollForm.js b/ui/form/ListScrollForm.js
index 00a6da1..a6de8db 100644
--- a/ui/form/ListScrollForm.js
+++ b/ui/form/ListScrollForm.js
@@ -73,14 +73,6 @@ module.exports = class ListScrollForm extends Form {
         }
       }
 
-      if (telc.isPageUp(keyBuf)) {
-        this.previousPage()
-        ret = false; break handleKeyPress
-      } else if (telc.isPageDown(keyBuf)) {
-        this.nextPage()
-        ret = false; break handleKeyPress
-      }
-
       ret = super.keyPressed(keyBuf)
     }
 
@@ -116,26 +108,6 @@ module.exports = class ListScrollForm extends Form {
     super.firstInput(...args)
   }
 
-  previousPage() {
-    this.curIndex -= this.h
-    this.scrollItems -= this.h
-    if (this.curIndex < 0) {
-      this.curIndex = 0
-      this.scrollItems = 0
-    }
-    this.updateSelectedElement()
-  }
-
-  nextPage() {
-    this.curIndex += this.h
-    this.scrollItems += this.h
-    if (this.curIndex >= this.inputs.length) {
-      this.curIndex = this.inputs.length - 1
-      this.scrollToEnd()
-    }
-    this.updateSelectedElement()
-  }
-
   scrollElementIntoEndOfView(element) {
     // We can decide how many items to scroll past by moving forward until
     // the item's far edge is visible.