Skip to content
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

Add carriage return "\r" to showInvisibles #99

Closed
BPScott opened this issue Jul 4, 2018 · 4 comments
Closed

Add carriage return "\r" to showInvisibles #99

BPScott opened this issue Jul 4, 2018 · 4 comments

Comments

@BPScott
Copy link
Member

BPScott commented Jul 4, 2018

Prettier will format files using the first line-ending it sees. This means that files that use
\r\n as line breaks will keep them.

showInvisibles has conversions for space, \n and \t. It'd be good if it had a replacement for \r as well so report output doesn't look goofy for crlf files as the terminal tries to render the literal carriage return.

Unfortunately I'm not sure what the best solution for this is. There's no character that screams "I'm a carriage return" that I'm aware of. Perhaps ⏎ can be used for \n (as it is now), and a slightly different character can be used for a \r\n combo?

I reckon we can ignore files with just \r line endings (macos 9 lols)

@not-an-aardvark
Copy link
Member

I suppose another option would be to use ⏎ for both \r\n and \n, although maybe that would end up confusing because we would end up with messages like "Replace ⏎ with ⏎ ".

Another option would be to use the literal text \r (backslash followed by r) for carriage returns.

@BPScott
Copy link
Member Author

BPScott commented Jul 5, 2018

"Replace ⏎ with ⏎ " is a confusing and I'd like to avoid it. Literal \r feels odd as it doesn't currently use escape codes for other characters.

How about ␍ (see https://en.wiktionary.org/wiki/%E2%90%8D)

@not-an-aardvark
Copy link
Member

Sounds good to me. Would you be interested in creating a PR?

@BPScott
Copy link
Member Author

BPScott commented Jul 5, 2018

There you go ^^

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants