-
-
Notifications
You must be signed in to change notification settings - Fork 24
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Fix a bunch of issues #30
Conversation
Proper tests for #24 (part about leading spaces) require previous fixes in this PR, so I merged this fix here too. |
Hey @stroncium, great work! Would you be able to copy test cases from https://github.com/chalk/wrap-ansi/pull/29/files#diff-1dd241c4cd3fd1dd89c570cee98b79dd into your PR to verify your fixes cover more stuff, so that I can close my PR? |
@vadimdemedes Most of them were already there, added remaining except this one:
as I do believe that there is a mistake and it shouldn't be trimmed with |
Hey @stroncium, PR works great overall, there's only one issue I was able to find: const chalk = require('chalk')
const figures = require('figures')
const wrapAnsi = require('.')
const str = [
`${chalk.green('?')} ${chalk.bold('select packages to update')}`,
'',
`${chalk.yellow('other')}`,
`${figures.pointer} ${figures.circle} standard-version ${chalk.green('devDep')} ${chalk.bold('MISSING > 5.0.0')} ${chalk.blue('https://github.com/conventional-changelog/standard-version#readme')}`,
''
].join('\n')
console.log(wrapAnsi(str, 64, {hard: true, trim: false})) Produces the following output: Link is moved over to the next line, instead of being wrapped as well. Here's the expected output: Would you be able to look into it? |
@vadimdemedes It actually isn't a regression, and it was there before and this behavior is locked in testcases. It boils down to following expectation failing:
// CC @sindresorhus
New expectation:
Arguably, in this particular case neither option is looking quite pretty, but for real life purposes it should work good, and it fixes the problem stated above for example. |
Works great, awesome work @stroncium! |
@stroncium Yes, the change makes sense to me. |
Really great work on this, @stroncium 🙌 |
Added tests, fixed incorrect treatment of rows which masked problem with tokenizer to proper way to treat tokens.
Fixes #23
Fixes #24
Fixes #25
Fixes #26
Fixes #27