« get me outta code hell

mtui - Music Text User Interface - user-friendly command line music player
about summary refs log tree commit diff
diff options
context:
space:
mode:
-rw-r--r--ui.js5
1 files changed, 3 insertions, 2 deletions
diff --git a/ui.js b/ui.js
index 0ae5266..441db03 100644
--- a/ui.js
+++ b/ui.js
@@ -1013,8 +1013,8 @@ class GrouplikeListingElement extends Form {
 
     // Just outright scrap the old items - don't deal with any selection stuff
     // (as a result of removeInput) yet.
+    form.children = form.children.filter(child => !form.inputs.includes(child));
     form.inputs = []
-    form.children = []
 
     const parent = this.grouplike[parentSymbol]
     if (parent) {
@@ -2119,8 +2119,9 @@ class ContextMenu extends FocusElement {
     // 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.children = this.form.children.filter(
+      child => !this.form.inputs.includes(child));
     this.form.inputs = []
-    this.form.children = []
   }
 
   fixLayout() {