From 888f8b31e71141aee2436c154d992552c35e3d13 Mon Sep 17 00:00:00 2001 From: Pedro J. Estébanez Date: Mon, 16 Jan 2017 18:03:38 +0100 Subject: 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. Cherry-picked from 7dbb1c0571c0d1fb26c28552b09430807cc4d717 --- core/ustring.cpp | 11 ++++++++++- 1 file changed, 10 insertions(+), 1 deletion(-) (limited to 'core/ustring.cpp') diff --git a/core/ustring.cpp b/core/ustring.cpp index 5f19a6cff..df3815351 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; } -- cgit v1.2.3-70-g09d2