You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Describe the bug
When adding a paragraph using TextBoxBuilder.addParagraph, it uses a ParagraphBuilder internally. That ParagraphBuilder discards everything after the first newline, which is surprising behavior.
This is actually an interesting question. I think my preference is that single newlines be replaced with whitespace, and multiple consecutive newlines be replaced with n-1 newlines.
For instance, if I say
.addParagraph(""" okay this is a really long paragraph where I need multiple lines and stuff just to capture the spectacle the player sees""".trimIndent()
I don't necessarily want my in-editor linebreaks to be reflected exactly in game; just wordwrap it into whatever container it's in.
But if I say
.addParagraph(""" In the beginning, life was good. But at some point, it stopped being good.""".trimIndent())
I wouldn't expect this to be collapsed into a single sentence. Really I should use multiple addParagraph calls, but maybe it's being loaded from an external translations file or something. I'd be fine with In the beginning, life was good.\nBut at some point, it stopped being good.. If I really want to preserve the linebreak in the source code, I can add another newline.
I'm open to other opinions here, this seems admittedly subjective.
Screenshots
Additional context String.withNewLinesStripped is at the heart of this. It doesn't actually strip newlines; it deletes everything after the first newline.
The text was updated successfully, but these errors were encountered:
Describe the bug
When adding a paragraph using
TextBoxBuilder.addParagraph
, it uses aParagraphBuilder
internally. ThatParagraphBuilder
discards everything after the first newline, which is surprising behavior.To Reproduce
Code something like this:
Expected behavior
This is actually an interesting question. I think my preference is that single newlines be replaced with whitespace, and multiple consecutive newlines be replaced with n-1 newlines.
For instance, if I say
I don't necessarily want my in-editor linebreaks to be reflected exactly in game; just wordwrap it into whatever container it's in.
But if I say
I wouldn't expect this to be collapsed into a single sentence. Really I should use multiple
addParagraph
calls, but maybe it's being loaded from an external translations file or something. I'd be fine withIn the beginning, life was good.\nBut at some point, it stopped being good.
. If I really want to preserve the linebreak in the source code, I can add another newline.I'm open to other opinions here, this seems admittedly subjective.
Screenshots
Additional context
String.withNewLinesStripped is at the heart of this. It doesn't actually strip newlines; it deletes everything after the first newline.
The text was updated successfully, but these errors were encountered: