-
-
Notifications
You must be signed in to change notification settings - Fork 58
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
don't trim wrapped lines #93
base: main
Are you sure you want to change the base?
Conversation
oh, this fails some tests. is the current behaviour expected? |
That seems like a good idea. I will try it out later this afternoon to see how it reacts with padding options. In the mean time, it would be nice to add some tests to check if it works perfectly with the padding/wrapping Boxen does. You can update the snapshots and commit the changes for CI to complete the tests. |
Hi, I'm back after some experimenting. Here I've made a simple test to see how text looks like with the import wrapAnsi from 'wrap-ansi'
const text = `
Hello
I like cookies very much
anticonstitucional indeed agree
`
console.log(text)
console.log('----- 20')
console.log(wrapAnsi(text, 20, {
hard: true,
trim: false
}))
console.log('----- 10')
console.log(wrapAnsi(text, 10, {
hard: true,
trim: false
}))
console.log('----- 8')
console.log(wrapAnsi(text, 8, {
hard: true,
trim: false
}))
console.log('----- 6')
console.log(wrapAnsi(text, 6, {
hard: true,
trim: false
})) Here is what the output looks like:
It does keep the formatting of the original text (The hello with 4 spaces on the left), which is nice. But it also doesn't trim spaces between words when they are wrapped to a new line. With a result like:
Which looks very unpleasing to me. Is that the intended way What are your thoughts on this @sindresorhus ? |
Re-pinging @sindresorhus |
While it's not ideal, that's how it's documented to work, so it is the intended behavior there. That package probably needs a more fine-grained option: |
unwrapped/before/after: