diff --git a/lib/src/modules/dotnet/tests/testdata/0224ad9739f5fa64a2a63e23ef6a0e3152020fc7964243fc845cad499d11f9ab.out b/lib/src/modules/dotnet/tests/testdata/0224ad9739f5fa64a2a63e23ef6a0e3152020fc7964243fc845cad499d11f9ab.out index e7dfa181a..0dea9ecee 100644 --- a/lib/src/modules/dotnet/tests/testdata/0224ad9739f5fa64a2a63e23ef6a0e3152020fc7964243fc845cad499d11f9ab.out +++ b/lib/src/modules/dotnet/tests/testdata/0224ad9739f5fa64a2a63e23ef6a0e3152020fc7964243fc845cad499d11f9ab.out @@ -70,7 +70,9 @@ assembly_refs: build_number: 0 revision_number: 0 resources: - - name: "\r\n" + - name: | + +  classes: - fullname: "OctopusRPA.Csv.CsvHelper" name: "CsvHelper" diff --git a/proto-yaml/src/lib.rs b/proto-yaml/src/lib.rs index 1a8829564..e9d89aaef 100644 --- a/proto-yaml/src/lib.rs +++ b/proto-yaml/src/lib.rs @@ -337,11 +337,23 @@ impl Serializer { ReflectValueRef::F64(v) => write!(self.output, "{v:.1}")?, ReflectValueRef::Bool(v) => write!(self.output, "{v}")?, ReflectValueRef::String(v) => { - write!( - self.output, - "\"{}\"", - Self::escape(v).paint(self.colors.string) - )?; + if v.contains('\n') { + write!(self.output, "{}", "|".paint(self.colors.string))?; + for line in v.split('\n') { + self.newline()?; + write!( + self.output, + "{}", + line.paint(self.colors.string) + )?; + } + } else { + write!( + self.output, + "\"{}\"", + Self::escape(v).paint(self.colors.string) + )?; + } } ReflectValueRef::Bytes(v) => { write!( diff --git a/proto-yaml/src/tests/testdata/1.out b/proto-yaml/src/tests/testdata/1.out index 1ea436dfe..89c648ced 100644 --- a/proto-yaml/src/tests/testdata/1.out +++ b/proto-yaml/src/tests/testdata/1.out @@ -4,14 +4,18 @@ int32_dec: 123 str: "foo" repeated_msg: - int32_dec: 456 - str: "bar\nbar" + str: | + bar + bar - int32_dec: 789 str: "foo\\bar" map_string_string: "foo\nbar": "bar" nested_msg: int32_dec: 1234 - str: "qux\nfoo" + str: | + qux + foo map_string_string: "bar": "baz" "foo": "bar" \ No newline at end of file