feat: add option to disable stripAnsi#15
feat: add option to disable stripAnsi#15ikatyang wants to merge 1 commit intosindresorhus:masterfrom
stripAnsi#15Conversation
|
I don't understand the use-case. How are you using this? This module is meant to measure the visual width. |
|
We always break line if the line fit the |
|
Does it matter, though?
From a correctness standpoint then, yes, we shouldn't strip ANSI in Prettier's case, but from a practical standpoint I don't think it's an issue? |
|
I think https://github.com/sindresorhus/string-length is what you actually want to use. This module is for text printed in the terminal. |
|
CJK characters should be measured as 2-char width (visual width):
So I think We do need the feature for text printed but not in the terminal so that we (maybe) need the ability to disable the So I'm going to close it now unless someone open an issue about this in prettier. @sindresorhus thanks for your quick response! |
Why? Doesn't that mean that a markdown paragraph written using almost entirely CJK characters would break at 40 characters instead of 80? That seems surprising to me. Do you want to treat it this way because those characters often print as slightly-wider-than-1-character due to them not being in the monospace font that the rest of the text is rendered in? |

Use for prettier, need this option since there may be ansi strings in the source code.