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

Fix newline at end of file #47

Merged
merged 2 commits into from
Aug 22, 2020
Merged

Fix newline at end of file #47

merged 2 commits into from
Aug 22, 2020

Conversation

Clashsoft
Copy link
Member

@Clashsoft Clashsoft commented Aug 22, 2020

This was due to the convention of having \n as the text of the EOF fragment. Because FileFragmentMap.replace calls trim() when replacing an old fragment, the line break was removed. The new convention always uses the empty string as the EOF fragment text, hence the change to FragmentMapBuilder.exitFile()). The line break is now added to EOF#gap-before.

Bugfixes

  • The code generator no longer removes newlines at the end of existing files.

This was due to the convention of having "\n" as the text of the EOF fragment.
Due to FragmentMapBuilder calling trim() when replacing an old fragment,
the line break was removed.
The new convention always uses the empty string as the EOF fragment text,
hence the change to FragmentMapBuilder.exitFile()).
The line break is now added to EOF#gap-before.
@Clashsoft Clashsoft added the bug Something isn't working label Aug 22, 2020
@Clashsoft Clashsoft added this to the v1.2.2 milestone Aug 22, 2020
@Clashsoft Clashsoft self-assigned this Aug 22, 2020
@Clashsoft Clashsoft merged commit cc03c1d into bugfix Aug 22, 2020
@Clashsoft Clashsoft deleted the fix/eof-newline branch August 22, 2020 19:53
@Clashsoft Clashsoft added the regression Things that used to work, but are broken again label Aug 23, 2020
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working regression Things that used to work, but are broken again
Projects
None yet
Development

Successfully merging this pull request may close these issues.

1 participant