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

Preserve CRLF line endings #606

Open
wants to merge 1 commit into
base: dev
Choose a base branch
from
Open

Preserve CRLF line endings #606

wants to merge 1 commit into from

Conversation

jdalton
Copy link
Contributor

@jdalton jdalton commented Apr 21, 2019

This PR preserves CRLF line endings and addresses #367, #498, #572, #578, #592, #593.

Update:

Still needs tests.

Update:

I'm manually testing on Windows and finding some issues with this PR.
I'll update as I resolve them 👷

Update:

I'll add logic to detect existing line endings used to avoid using os.EOL in certain situations.

@@ -72,7 +72,7 @@ let option = {
var lastIndex = spaces.lastIndexOf('\n');

// Do not continue if there is no line break:
if (lastIndex < 0) return;
if (lastIndex === -1) return;
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@jdalton, out of curiosity, there'll be no bug/issue with this line, it's just a nitpick, right?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Ah, sorry about that. No bug. I usually try to avoid unfocused changes like that.

Let me know if you spot others like it and I’ll revert them.

@tonyganch
Copy link
Member

@jdalton, is this PR still WIP?

@jdalton
Copy link
Contributor Author

jdalton commented May 19, 2019

@tonyganch

, is this PR still WIP

Yes! I still need add detection of newline use based on the nearest other newline instead of using ‘os.EOL’.

Update:

I'm getting closer. I've added a nearestNewline() helper and got it working. I needed to feed the plugins the text, so once I clean things up and push we can bikeshed all that.

@StadnikovP
Copy link

Please tell me what's wrong with this edit?

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

Successfully merging this pull request may close these issues.

3 participants