poryscript icon indicating copy to clipboard operation
poryscript copied to clipboard

Format breaks when compiling multiline strings on Windows

Open Mawootad opened this issue 1 year ago • 1 comments

On Windows, when compiling formatted strings, eg:

format("This is a string
that is on multiple lines")

The resulting compiled string may end up with invalid line breaks in it, eg:

.string "This is a string
that"
.string "is on multiple lines"

This is using the 3.3 Linux Poryscript running a make script through WSL2. The issue seems to happen regardless of using CRLF or just LF endings as performed via git config core.eol lf and git add --update --renormalize.

Mawootad avatar Aug 10 '24 01:08 Mawootad

However on my Ubuntu 22.10 this does not happens.

text MultilineStringOnLinux{
	format("This is a string
that is on multiple lines")
}

Gets transformed

MultilineStringOnLinux::
# 810 "data/maps/DewfordTown_Gym/scripts.pory"
	.string "This is a string that is on multiple\n"
	.string "lines$"

with poryscript 3.3.0

ForwardFeed avatar Aug 10 '24 11:08 ForwardFeed

07a2166e1c08076f60bbe12bde0d569e44da528c

IMO this behavior ought to never be used, but Poryscript will now collapse those newlines into a space character.

In other words:

format("This is a string
that is on multiple lines")

is treated as

format("This is a string that is on multiple lines")

huderlem avatar Nov 05 '24 01:11 huderlem

Thanks for the fix. I agree that the behavior is iffy, but it is useful for larger text blurbs and the fact that it behaved differently between Linux and Windows has lead to some issues on our project where test strings end up getting committed because they build on some machines but not others. This will definitely save us some headaches.

Mawootad avatar Nov 05 '24 01:11 Mawootad