- var section = infinite.splice(topIndex, pageSize).join('\n');
- return section + '\n' + chalk.dim('(Move up and down to reveal more choices)');
+ return infinite.splice(topIndex, pageSize);
+ }
+
+ getFiniteLines(lines, active, pageSize) {
+ var topIndex = active - pageSize / 2;
+ if (topIndex < 0) {
+ topIndex = 0;
+ } else if (topIndex + pageSize > lines.length) {
+ topIndex = lines.length - pageSize;
+ }
+ return lines.splice(topIndex, pageSize);