« get me outta code hell

only show log pane once first message is displayed - 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>2020-07-17 19:08:09 -0300
committerFlorrie <towerofnix@gmail.com>2020-07-17 19:08:09 -0300
commit12ff28d327d72541234572a592c57f449467863f (patch)
treef49e6d30ce300e0bbdebb9ecf6c0d806d655a09a
parent602426894d04d4a1d6878a585b08eb6d45662118 (diff)
only show log pane once first message is displayed
-rw-r--r--ui.js9
1 files changed, 8 insertions, 1 deletions
diff --git a/ui.js b/ui.js
index 6562139..3bac8c6 100644
--- a/ui.js
+++ b/ui.js
@@ -247,6 +247,12 @@ class AppElement extends FocusElement {
 
     this.log = new Log()
     this.logPane.addChild(this.log)
+    this.logPane.visible = false
+
+    this.log.on('log-message', () => {
+      this.logPane.visible = true
+      this.fixLayout()
+    })
 
     if (!this.config.showTabberPane) {
       this.tabberPane.visible = false
@@ -1264,7 +1270,7 @@ class AppElement extends FocusElement {
       this.logPane.w = leftWidth
       this.logPane.h = 6
       this.log.fillParent()
-      this.log.fixLayout()
+      this.log.fixAllLayout()
     }
 
     if (this.tabberPane.visible) {
@@ -4413,6 +4419,7 @@ class Log extends ListScrollForm {
     this.addInput(logMessage)
     this.fixLayout()
     this.scrollToEnd()
+    this.emit('log-message', logMessage)
     return logMessage
   }
 }