« 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/ListScrollForm.js
diff options
context:
space:
mode:
Diffstat (limited to 'ui/form/ListScrollForm.js')
-rw-r--r--ui/form/ListScrollForm.js8
1 files changed, 7 insertions, 1 deletions
diff --git a/ui/form/ListScrollForm.js b/ui/form/ListScrollForm.js
index b23f973..7d2b083 100644
--- a/ui/form/ListScrollForm.js
+++ b/ui/form/ListScrollForm.js
@@ -20,11 +20,17 @@ module.exports = class ListScrollForm extends Form {
     // visible and we won't bother iterating over them.
     const itemsPastScroll = this.inputs.slice(this.scrollItems)
 
+    // We do need to hide them, though.
+    const itemsBeforeScroll = this.inputs.slice(0, this.scrollItems)
+    for (const item of itemsBeforeScroll) {
+      item.visible = false
+    }
+
     // This variable stores how far along the respective axis (as defined by
     // posProp) the next element should be.
     let nextPos = 0
 
-    for (let item of itemsPastScroll) {
+    for (const item of itemsPastScroll) {
       item[this.posProp] = nextPos
       nextPos += item[this.sizeProp]