Skip to content

Commit

Permalink
Merge f5f2464 into e910f82
Browse files Browse the repository at this point in the history
  • Loading branch information
SamVerschueren committed Jun 14, 2017
2 parents e910f82 + f5f2464 commit b1c97d2
Show file tree
Hide file tree
Showing 2 changed files with 10 additions and 2 deletions.
5 changes: 5 additions & 0 deletions index.js
Original file line number Diff line number Diff line change
Expand Up @@ -131,6 +131,11 @@ function exec(str, cols, opts) {
rows.push('');
}

if (rowLength + lengths[i] > cols && options.wordWrap === false) {
wrapWord(rows, word, cols);
continue;
}

rows[rows.length - 1] += word;
}

Expand Down
7 changes: 5 additions & 2 deletions test.js
Original file line number Diff line number Diff line change
Expand Up @@ -81,8 +81,11 @@ test('no word-wrapping', t => {
const res = fn(fixture3, 15, {wordWrap: false});
t.is(res, '12345678\n901234567890 12\n345');

const res2 = fn(fixture, 5, {wordWrap: false});
t.is(res2, 'The q\nuick\nbrown\nfox j\numped\nover\nthe l\nazy d\nog an\nd the\nn ran\naway\nwith\nthe u\nnicor\nn.');
const res2 = fn(fixture3, 5, {wordWrap: false});
t.is(res2, '12345\n678\n90123\n45678\n90 12\n345');

const res3 = fn(fixture, 5, {wordWrap: false});
t.is(res3, 'The q\nuick\nbrown\nfox j\numped\nover\nthe l\nazy d\nog an\nd the\nn ran\naway\nwith\nthe u\nnicor\nn.');
});

// https://github.com/chalk/wrap-ansi/issues/10
Expand Down

0 comments on commit b1c97d2

Please sign in to comment.