diff options
| author | Pedro J. Estébanez <pedrojrulez@gmail.com> | 2017-01-16 18:03:38 +0100 |
|---|---|---|
| committer | Pedro J. Estébanez <pedrojrulez@gmail.com> | 2017-01-16 18:03:51 +0100 |
| commit | 7dbb1c0571c0d1fb26c28552b09430807cc4d717 (patch) | |
| tree | 5bd408f9a64475a5ddd2c34f3a4c8c65844a96ee /core/ustring.cpp | |
| parent | 681575fa7123592897090c6cce44402c4e45baeb (diff) | |
| download | redot-engine-7dbb1c0571c0d1fb26c28552b09430807cc4d717.tar.gz | |
Improve .tscn VCS
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.
Diffstat (limited to 'core/ustring.cpp')
| -rw-r--r-- | core/ustring.cpp | 11 |
1 files changed, 10 insertions, 1 deletions
diff --git a/core/ustring.cpp b/core/ustring.cpp index f9c10615b3..a21d5ec594 100644 --- a/core/ustring.cpp +++ b/core/ustring.cpp @@ -3286,8 +3286,17 @@ String String::c_escape() const { escaped=escaped.replace("\t","\\t"); escaped=escaped.replace("\v","\\v"); escaped=escaped.replace("\'","\\'"); - escaped=escaped.replace("\"","\\\""); escaped=escaped.replace("\?","\\?"); + escaped=escaped.replace("\"","\\\""); + + return escaped; +} + +String String::c_escape_multiline() const { + + String escaped=*this; + escaped=escaped.replace("\\","\\\\"); + escaped=escaped.replace("\"","\\\""); return escaped; } |
