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

Break line on multiline strings #499

Merged
merged 1 commit into from
Aug 10, 2020
Merged

Break line on multiline strings #499

merged 1 commit into from
Aug 10, 2020

Conversation

belka-ew
Copy link
Collaborator

@belka-ew belka-ew commented Aug 3, 2020

2 Bugs:

  • chooseLineBreakTokens expects to get tokens of a single line. But since a string with newlines is a single token, the newlines inside it weren't acknowledged. Further chooseLineBreakTokens calculates the length of the tokens by using tokens.map!(a => tokenLength(a)).sum(). tokenLength() takes only the length of the string literal before the newline (which is actually correct if no other tokens forllow the string).
  • currentLineLength += cast(uint) o; // where o is the length of the string after the last newline. currentLineLength should be just o since the length is just the length on the string on the new line without the length of the tokens on the previous line.

@WebFreak001 WebFreak001 linked an issue Aug 3, 2020 that may be closed by this pull request
Copy link
Member

@WebFreak001 WebFreak001 left a comment

Choose a reason for hiding this comment

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

LGTM, great job

@belka-ew
Copy link
Collaborator Author

belka-ew commented Aug 8, 2020

No auto-merge label :(

@dlang-bot dlang-bot merged commit 58b2c6e into dlang-community:master Aug 10, 2020
@belka-ew belka-ew deleted the bug/long-string branch August 14, 2020 13:00
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.

break after long string literals
3 participants