-
-
Notifications
You must be signed in to change notification settings - Fork 21.6k
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
Greater VCS friendliness #7002
Greater VCS friendliness #7002
Conversation
Can you provide a before/after example? :) |
Wait before merging this, I want to give it a check On Oct 31, 2016 16:56, "Rémi Verschelde" notifications@github.com wrote:
|
@reduz Definitely, I'm not touching VariantParser personally :p |
Before:
After (comments added in uppercase):
|
@reduz Ping :) I've tested the patch locally and it seems to work fine. |
escaped=escaped.replace("\"","\\\""); | ||
escaped=escaped.replace("\?","\\?"); | ||
|
||
return escaped; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
If changing the order makes it more VCS friendly, just change the order, no need to add a condition
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I think it's not just changing the order here, but actually disabling various escapes when in VCS friendly mode.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I think the vcs-friendly mode would be better in its own function.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Akien is right. Now, about splitting the function into the two use cases, I did it this way with a default value for the argument to keep the API as untouched as possible, but I see no reason why it couldn't be done if you prefer.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I think a new method would be good indeed, as the current change would mean exposing a boolean argument to the GDScript API, where it is not particularly meaningful as par of a c_escape()
function IINM.
Maybe add a tscn_escape
method (or a better name if you think of one), which potentially wouldn't need to be exposed to GDScript.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I've decided to name it c_escape_multiline()
. The rationale is that it performs C-style string escaping as well, but keeping the multiline structure of the source data (and any other format control characters like tab and those exotic vertical tabs, backspace, etc.).
That name also makes it clear its intent where it's used.
What do you think?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Sounds good :)
Serialize dictionaries adding newlines between key-value pairs Serialize group lists also with newlines in between Serialize string properties escaping only " and \ (needed for a good diff experience with built-in scripts and shaders) Bonus: Make AnimationPlayer serialize its blend times always sorted so their order is predictable in the .tscn file. This PR is back-compat; won't break the load of existing files.
eb0d342
to
7dbb1c0
Compare
Make
AnimationPlayer
serialize its blend times always sorted so their order is predictable in the .tscn file.Serialize dictionaries adding newlines between key-value pairs.
Serialize group lists also with newlines in between.
Serialize string properties escaping only
"
and\
(needed for a good diff experience with built-in scripts).This PR is back-compat; won't break loading of existing files.