Skip to content

Commit

Permalink
feat: support config columns
Browse files Browse the repository at this point in the history
  • Loading branch information
fi3ework committed Jun 24, 2021
1 parent 9694cd9 commit aa6f232
Showing 1 changed file with 4 additions and 4 deletions.
8 changes: 4 additions & 4 deletions index.js
Original file line number Diff line number Diff line change
Expand Up @@ -6,11 +6,11 @@ const sliceAnsi = require('slice-ansi');

const defaultTerminalHeight = 24;

const getWidth = stream => {
const getWidth = (stream, defaultColumns) => {
const {columns} = stream;

if (!columns) {
return 80;
return defaultColumns;
}

return columns;
Expand All @@ -31,9 +31,9 @@ const fitToTerminalHeight = (stream, text) => {
text.length);
};

const main = (stream, {showCursor = false} = {}) => {
const main = (stream, {showCursor = false, defaultColumns = 80} = {}) => {
let previousLineCount = 0;
let previousWidth = getWidth(stream);
let previousWidth = getWidth(stream, defaultColumns);
let previousOutput = '';

const render = (...args) => {
Expand Down

0 comments on commit aa6f232

Please sign in to comment.