« 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.js10
1 files changed, 10 insertions, 0 deletions
diff --git a/ui.js b/ui.js
index 32cbb72..88d3eb0 100644
--- a/ui.js
+++ b/ui.js
@@ -79,6 +79,8 @@ class AppElement extends FocusElement {
       () => this.playGrouplikeItem(item, false)))
     this.queueListingElement.on('shuffle', () => this.shuffleQueue())
     this.queueListingElement.on('clear', () => this.clearQueue())
+    this.queueListingElement.on('select main listing',
+      () => this.form.selectInput(this.grouplikeListingElement))
 
     this.paneRight.addChild(this.queueListingElement.pathElement)
     this.form.addInput(this.queueListingElement.pathElement, false)
@@ -661,6 +663,14 @@ class QueueListingElement extends GrouplikeListingElement {
       return super.keyPressed(keyBuf)
     }
   }
+
+  updateSelectedElement() {
+    if (this.inputs.length) {
+      super.updateSelectedElement()
+    } else {
+      this.emit('select main listing')
+    }
+  }
 }
 
 class PlaybackInfoElement extends DisplayElement {