« get me outta code hell

group.comment support / new help message - 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-12 23:56:19 -0300
committerFlorrie <towerofnix@gmail.com>2018-06-12 23:56:21 -0300
commit5b21b38bf5358d40e37de83260a3b9298380c782 (patch)
tree567a61f5671f0f5bd25e659b20c7ad5ca6e5924c
parent13f49822f637ca5582f593bcc0dae8a5003390f3 (diff)
group.comment support / new help message
..mentioning that you can add stuff to ~/Music to make it show up in the
default mtui playlist.
-rwxr-xr-xindex.js3
-rw-r--r--package-lock.json5
-rw-r--r--package.json3
m---------tui-lib0
-rw-r--r--ui.js13
5 files changed, 22 insertions, 2 deletions
diff --git a/index.js b/index.js
index 97da517..b1c4ced 100755
--- a/index.js
+++ b/index.js
@@ -59,6 +59,9 @@ async function main() {
 
   let grouplike = {
     name: 'My ~/Music Library',
+    comment: (
+      '(Add songs and folders to ~/Music to make them show up here,' +
+      ' or pass mtui your own playlist.json file!)'),
     source: ['crawl-local', process.env.HOME + '/Music']
   }
 
diff --git a/package-lock.json b/package-lock.json
index c0a7cfe..8ba16fd 100644
--- a/package-lock.json
+++ b/package-lock.json
@@ -298,6 +298,11 @@
       "version": "1.0.2",
       "resolved": "https://registry.npmjs.org/util-deprecate/-/util-deprecate-1.0.2.tgz",
       "integrity": "sha1-RQ1Nyfpw3nMnYvvS1KKJgUGaDM8="
+    },
+    "word-wrap": {
+      "version": "1.2.3",
+      "resolved": "https://registry.npmjs.org/word-wrap/-/word-wrap-1.2.3.tgz",
+      "integrity": "sha512-Hz/mrNwitNRh/HUAtM/VT/5VH+ygD6DV7mYKZAtHOrbs8U7lvPS6xf7EJKMF0uW1KJCl0H701g3ZGus+muE5vQ=="
     }
   }
 }
diff --git a/package.json b/package.json
index 047b6bb..c271b28 100644
--- a/package.json
+++ b/package.json
@@ -19,6 +19,7 @@
     "node-fetch": "^2.1.2",
     "node-natural-sort": "^0.8.6",
     "sanitize-filename": "^1.6.1",
-    "tempy": "^0.2.1"
+    "tempy": "^0.2.1",
+    "word-wrap": "^1.2.3"
   }
 }
diff --git a/tui-lib b/tui-lib
-Subproject 774e1e094f0873be539242c5c80a4130200cb70
+Subproject c5b3a076963517c93b6596f3e0a860be1d80ef8
diff --git a/ui.js b/ui.js
index 9d92229..a20fb52 100644
--- a/ui.js
+++ b/ui.js
@@ -11,6 +11,7 @@ const Label = require('./tui-lib/ui/Label')
 const ListScrollForm = require('./tui-lib/ui/form/ListScrollForm')
 const Pane = require('./tui-lib/ui/Pane')
 const RecordStore = require('./record-store')
+const WrapLabel = require('./tui-lib/ui/WrapLabel')
 const telc = require('./tui-lib/util/telchars')
 const unic = require('./tui-lib/util/unichars')
 
@@ -435,11 +436,19 @@ class GrouplikeListingElement extends FocusElement {
 
     this.pathElement = new PathElement()
     this.addChild(this.pathElement)
+
+    this.commentLabel = new WrapLabel()
+    this.addChild(this.commentLabel)
   }
 
   fixLayout() {
+    this.commentLabel.w = this.contentW
+
     this.form.w = this.contentW
-    this.form.h = this.contentH - 1
+    this.form.h = this.contentH
+    this.form.y = this.commentLabel.bottom
+    this.form.h -= this.commentLabel.h
+    this.form.h -= this.pathElement.h
 
     this.pathElement.y = this.contentH - 1
     this.pathElement.w = this.contentW
@@ -475,6 +484,8 @@ class GrouplikeListingElement extends FocusElement {
       throw new Error('Attempted to call buildItems before a grouplike was loaded')
     }
 
+    this.commentLabel.text = this.grouplike.comment || ''
+
     const wasSelected = this.isSelected
     const form = this.form