« get me outta code hell

mtui - Music Text User Interface - user-friendly command line music player
about summary refs log tree commit diff
path: root/ui.js
diff options
context:
space:
mode:
Diffstat (limited to 'ui.js')
-rw-r--r--ui.js17
1 files changed, 10 insertions, 7 deletions
diff --git a/ui.js b/ui.js
index 3d71d24..4d6b637 100644
--- a/ui.js
+++ b/ui.js
@@ -966,9 +966,9 @@ class GrouplikeListingElement extends Form {
     const wasSelected = this.isSelected
     const form = this.form
 
-    while (form.inputs.length) {
-      form.removeInput(form.inputs[0], true, {fixLayout: false})
-    }
+    // Just outright scrap the old items - don't deal with any selection stuff
+    // (as a result of removeInput) yet.
+    form.inputs = []
 
     const parent = this.grouplike[parentSymbol]
     if (parent) {
@@ -2062,10 +2062,13 @@ class ContextMenu extends FocusElement {
   }
 
   clearItems() {
-    const inputs = this.form.inputs.slice()
-    for (const input of inputs) {
-      this.form.removeInput(input)
-    }
+    // Abhorrent hack - just erases children from memory. Leaves children
+    // thinking they've still got a parent, though. (Necessary to avoid crazy
+    // select() loops that probably explode the world... speaking of things
+    // to forget, that one time when I was figuring out menus in the queue.
+    // This makes them work.)
+    this.form.inputs = []
+    this.form.children = []
   }
 
   fixLayout() {