diff options
-rwxr-xr-x | index.js | 3 | ||||
-rw-r--r-- | package-lock.json | 5 | ||||
-rw-r--r-- | package.json | 3 | ||||
m--------- | tui-lib | 0 | ||||
-rw-r--r-- | ui.js | 13 |
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 |