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

Ensure files end with a single new line #477

Merged
merged 4 commits into from
Nov 15, 2021
Merged

Ensure files end with a single new line #477

merged 4 commits into from
Nov 15, 2021

Conversation

belav
Copy link
Owner

@belav belav commented Nov 11, 2021

closes #464

var trimmed = 0;
for (; trimmed < Output.Length; trimmed++)
{
if (Output[^(trimmed + 1)] != '\r' && Output[^(trimmed + 1)] != '\n')
Copy link
Collaborator

Choose a reason for hiding this comment

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

Does this work for Unix line endings that don't have a carriage return?

Copy link
Owner Author

Choose a reason for hiding this comment

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

It does, I have some unit tests for it in DocPrinterTests. I did have a copy paste error and wasn't actually testing just "\n" though.

@belav belav merged commit 12b9e1f into master Nov 15, 2021
@belav belav deleted the single-new-line branch November 15, 2021 16:32
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

Successfully merging this pull request may close these issues.

File with multiple newlines at the end keeps them
2 participants