« 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--todo.txt7
-rw-r--r--ui.js8
2 files changed, 13 insertions, 2 deletions
diff --git a/todo.txt b/todo.txt
index 161d7f9..3470204 100644
--- a/todo.txt
+++ b/todo.txt
@@ -384,6 +384,7 @@ TODO: Revealing a track shouldn't forcibly position it at the bottom of the
       if the item is already visible, and if it's above the current scroll
       area, make it appear at the top of the listing view instead of the
       bottom.
+      (Done!)
 
 TODO: Text file support. Yes. Heck yes. Heck hecking yes.
       Read text files contained in your music library folders. If there is a
@@ -396,3 +397,9 @@ TODO: Make 'after selected song' the default in the context menu, too. I miight
       general, and if you prefer 'after current song', that option isn't hard
       to discover and select.
       (Done!)
+
+TODO: Investigate why reveal() has distinct support for grouplikes as well as
+      tracks - you can't append actual groups to the queue (only their
+      flattened children) after all. But if you could -- I think reveal should
+      work the same for groups as it does for tracks, i.e. opening the parent
+      and then selecting the item.
diff --git a/ui.js b/ui.js
index 7ef13f0..aafe064 100644
--- a/ui.js
+++ b/ui.js
@@ -513,10 +513,14 @@ class AppElement extends FocusElement {
 
     const tabberListing = this.tabber.currentElement
     this.root.select(tabberListing)
+
+    const parent = item[parentSymbol]
     if (isGroup(item)) {
       tabberListing.loadGrouplike(item)
-    } else if (item[parentSymbol]) {
-      tabberListing.loadGrouplike(item[parentSymbol])
+    } else if (parent) {
+      if (tabberListing.grouplike !== parent) {
+        tabberListing.loadGrouplike(parent)
+      }
       tabberListing.selectAndShow(item)
     }
   }