From 5b21b38bf5358d40e37de83260a3b9298380c782 Mon Sep 17 00:00:00 2001 From: Florrie Date: Tue, 12 Jun 2018 23:56:19 -0300 Subject: group.comment support / new help message ..mentioning that you can add stuff to ~/Music to make it show up in the default mtui playlist. --- index.js | 3 +++ package-lock.json | 5 +++++ package.json | 3 ++- tui-lib | 2 +- ui.js | 13 ++++++++++++- 5 files changed, 23 insertions(+), 3 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 index 774e1e0..c5b3a07 160000 --- a/tui-lib +++ b/tui-lib @@ -1 +1 @@ -Subproject commit 774e1e094f0873be539242c5c80a4130200cb700 +Subproject commit c5b3a076963517c93b6596f3e0a860be1d80ef80 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 -- cgit 1.3.0-6-gf8a5