« get me outta code hell

Don't remove current track when clearing queue - mtui - Music Text User Interface - user-friendly command line music player
about summary refs log tree commit diff
diff options
context:
space:
mode:
authorFlorrie <towerofnix@gmail.com>2019-02-25 12:10:32 -0400
committerFlorrie <towerofnix@gmail.com>2019-02-25 12:10:32 -0400
commit94414a2456d5302305e8801200177e9313b76858 (patch)
treef1cac0b5bf921bfd83e4663d2b94056c304a9bf6
parente9ccfa2fd4221ddff4950d5180ee5c8fb0bf8117 (diff)
Don't remove current track when clearing queue
-rw-r--r--ui.js5
1 files changed, 4 insertions, 1 deletions
diff --git a/ui.js b/ui.js
index 90fb13a..eb4a0a9 100644
--- a/ui.js
+++ b/ui.js
@@ -503,7 +503,10 @@ class AppElement extends FocusElement {
   }
 
   clearQueue() {
-    this.queueGrouplike.items = []
+    // Clear the queue so that there aren't any items left in it (except for
+    // the track that's currently playing).
+    this.queueGrouplike.items = this.queueGrouplike.items
+      .filter(item => item === this.playingTrack)
     this.queueListingElement.buildItems()
     this.queueListingElement.pathElement.showItem(null)
   }