chalk / wrap-ansi

Wordwrap a string with ANSI escape codes
MIT License
120 stars 25 forks source link

Space at new lines #36

Closed grigorii-horos closed 4 years ago

grigorii-horos commented 5 years ago
wrapAnsi('Long line. Lorem ipsum dolor sit amet, consectetur adipiscing elit. Sed efficitur sapien et volutpat molestie. Curabitur facilisis rutrum luctus. Ut nec justo dui.',80,{trim:false})

This will split strint to

'Long line. Lorem ipsum dolor sit amet, consectetur adipiscing elit. Sed \n' +
'efficitur sapien et volutpat molestie. Curabitur facilisis rutrum luctus. Ut nec\n' +
' justo dui.' // <- You can see here a space before

I think that need option to do not move space at next line.

sindresorhus commented 5 years ago

It doesn't seem like you need {trim: false} for the above example. Can you elaborate on a real use-case where you need {trim: false} and also not having spaces moved to next line?


I think that need option to do not move space at next line.

Keep in mind that there's a high bar to add new options. We prefer to fix the defaults instead if possible.