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

[LG] Fix missing trailing line break with String.Readline() #3655

Merged
merged 7 commits into from
Apr 2, 2020

Conversation

Danieladu
Copy link
Collaborator

@Danieladu Danieladu commented Apr 1, 2020

In C#, LG use StringReader.ReadLine to read the content line from LG file, but there may exist some points that do not match the LG's requirements.

In C# doc: https://docs.microsoft.com/en-us/dotnet/api/system.io.stringreader.readline?view=netframework-4.8#remarks

The string that is returned does not contain the terminating carriage return or line feed. The returned value is null if the end-of-stream marker has been reached. That is to say, if there is nothing between the last line read and the end-of-stream marker, the method returns null.

So, the trailing newlines would be dropped when parsing the text with ReadLine method.

if the template is:

# template
- hi



and do some CRUD operation on this template, finally, we would get the template body:

- hi

the tailing newlines are missing.

@boydc2014 boydc2014 changed the title Fix the readline from string issue Fix missing trailing line break with String.Readline() Apr 1, 2020
@boydc2014 boydc2014 changed the title Fix missing trailing line break with String.Readline() [LG] Fix missing trailing line break with String.Readline() Apr 1, 2020
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.

3 participants