terminal-paginator
Advanced tools
Comparing version 2.0.0 to 2.0.1
18
index.js
@@ -16,3 +16,6 @@ 'use strict'; | ||
this.options = options || {}; | ||
this.footer = this.options.footer || '(Move up and down to reveal more choices)'; | ||
this.footer = this.options.footer; | ||
if (typeof this.footer !== 'string') { | ||
this.footer = '(Move up and down to reveal more choices)'; | ||
} | ||
this.firstRender = true; | ||
@@ -39,3 +42,3 @@ this.lastIndex = 0; | ||
// Return if we don't have enough visible lines to paginate | ||
if (lines.length <= limit) { | ||
if (lines.length <= limit || opts.paginate === false) { | ||
return output; | ||
@@ -56,14 +59,13 @@ } | ||
this.lastIndex = pos; | ||
if (opts.filterList === true) { | ||
lines = lines.filter(Boolean); | ||
} | ||
// Duplicate lines to create the illusion of an infinite list | ||
var infinite = lines.concat(lines).concat(lines); | ||
if (opts.filterList !== false) { | ||
infinite = infinite.filter(Boolean); | ||
} | ||
var topIndex = Math.max(0, pos + lines.length - this.position); | ||
// Create the visible list based on the limit and current cursor position | ||
var visible = infinite.splice(topIndex, limit); | ||
visible = visible.join('\n'); | ||
var visible = infinite.splice(topIndex, limit).join('\n'); | ||
if (this.footer) { | ||
@@ -70,0 +72,0 @@ visible += '\n'; |
{ | ||
"name": "terminal-paginator", | ||
"description": "Paginator used for rendering lists or choices for prompts in the terminal.", | ||
"version": "2.0.0", | ||
"version": "2.0.1", | ||
"homepage": "https://github.com/enquirer/terminal-paginator", | ||
@@ -6,0 +6,0 @@ "author": "Jon Schlinkert (https://github.com/jonschlinkert)", |
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
8273
70