« get me outta code hell

Fix path element not being updated for queue listing - 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>2018-06-13 08:11:05 -0300
committerFlorrie <towerofnix@gmail.com>2018-06-13 08:12:13 -0300
commit1a82a0cad985dc5d6e712c4e6e2f5705ae836ac7 (patch)
tree9a4bcb9838c0a387b7bc67fdeda27344b31f03fb
parent70f43924bfaf138c81e355f1acc2dfd2d4348a80 (diff)
Fix path element not being updated for queue listing
-rw-r--r--ui.js17
1 files changed, 9 insertions, 8 deletions
diff --git a/ui.js b/ui.js
index a20fb52..ac86a47 100644
--- a/ui.js
+++ b/ui.js
@@ -425,7 +425,7 @@ class GrouplikeListingElement extends FocusElement {
     this.grouplike = null
     this.recordStore = recordStore
 
-    this.form = new GrouplikeListingForm()
+    this.form = this.getNewForm()
     this.addChild(this.form)
 
     this.form.on('selected input', input => {
@@ -441,6 +441,10 @@ class GrouplikeListingElement extends FocusElement {
     this.addChild(this.commentLabel)
   }
 
+  getNewForm() {
+    return new GrouplikeListingForm()
+  }
+
   fixLayout() {
     this.commentLabel.w = this.contentW
 
@@ -448,7 +452,7 @@ class GrouplikeListingElement extends FocusElement {
     this.form.h = this.contentH
     this.form.y = this.commentLabel.bottom
     this.form.h -= this.commentLabel.h
-    this.form.h -= this.pathElement.h
+    this.form.h -= 1 // For the path element
 
     this.pathElement.y = this.contentH - 1
     this.pathElement.w = this.contentW
@@ -723,16 +727,13 @@ class PathItemElement extends FocusElement {
     this.arrowLabel.fixLayout()
     this.w = this.button.w + this.arrowLabel.w
     this.arrowLabel.x = this.button.right
+    this.h = 1
   }
 }
 
 class QueueListingElement extends GrouplikeListingElement {
-  constructor(...args) {
-    super(...args)
-
-    this.removeChild(this.form)
-    this.form = new QueueListingForm()
-    this.addChild(this.form)
+  getNewForm() {
+    return new QueueListingForm()
   }
 
   keyPressed(keyBuf) {