diff options
author | Florrie <towerofnix@gmail.com> | 2018-03-07 19:15:26 -0400 |
---|---|---|
committer | Florrie <towerofnix@gmail.com> | 2018-03-07 19:15:28 -0400 |
commit | 7c7d32d0136092d06f9747cc44c5a37bcc9832b8 (patch) | |
tree | 98bd40e2f2749dc15e69f7d8dcdadea444bd1b65 /src/loop-play.js | |
parent | c0f76f3de7cad551cd6170dc37f2f7ece6e025c5 (diff) |
Make (t) key only show information about one track
The showTrackInfo keybinding command can now take a number of next/ previous tracks to show.
Diffstat (limited to 'src/loop-play.js')
-rw-r--r-- | src/loop-play.js | 10 |
1 files changed, 7 insertions, 3 deletions
diff --git a/src/loop-play.js b/src/loop-play.js index b44e83f..0fd94e4 100644 --- a/src/loop-play.js +++ b/src/loop-play.js @@ -652,7 +652,11 @@ class PlayController extends EventEmitter { this.stopped = true } - logTrackInfo() { + logTrackInfo(upNextTrackCount = 3, previousTrackCount = undefined) { + if (typeof previousTrackCount === 'undefined') { + previousTrackCount = upNextTrackCount + } + const getColorMessage = t => { if (!t) return '\x1b[2m(No track)\x1b[0m' @@ -675,13 +679,13 @@ class PlayController extends EventEmitter { const tl = hc.timeline const tlI = hc.timelineIndex - for (let i = Math.max(0, tlI - 2); i < tlI; i++) { + for (let i = Math.max(0, tlI - (previousTrackCount - 1)); i < tlI; i++) { console.log(`\x1b[2m(Prev) ${getCleanMessage(tl[i])}\x1b[0m`) } console.log(`\x1b[1m(Curr) \x1b[1m${getColorMessage(tl[tlI])}\x1b[0m`) - for (let i = tlI + 1; i < Math.min(tlI + 3, tl.length); i++) { + for (let i = tlI + 1; i < Math.min(tlI + upNextTrackCount, tl.length); i++) { console.log(`(Next) ${getCleanMessage(tl[i])}`) } } |