« get me outta code hell

Don't reload the listing if it's unnecessary - 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:
authorFlorrie <towerofnix@gmail.com>2019-09-18 17:56:11 -0300
committerFlorrie <towerofnix@gmail.com>2019-09-18 17:56:11 -0300
commita5d3b710eb46e58708b8dbb51f5231ba534561fd (patch)
treec61d94a89751c45dad51d0248c45386017b91d59 /ui.js
parent43f5b514ed0bd2afcf887b830bc9ad42651f7d28 (diff)
Don't reload the listing if it's unnecessary
...in reveal(). This fixes the bug where the revealed track would always
be positioned at the bottom of the screen, which happened because
reloading the listing reset the scroll index back to the top.
Diffstat (limited to 'ui.js')
-rw-r--r--ui.js8
1 files changed, 6 insertions, 2 deletions
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)
     }
   }