From 7287eb172703c22ac30e622b15c32e05e6ddf42b Mon Sep 17 00:00:00 2001 From: Laurenz Stampfl <47084093+LaurenzV@users.noreply.github.com> Date: Wed, 30 Oct 2024 13:22:19 +0100 Subject: [PATCH] Change formatting of PostScriptOp (#44) --- src/functions.rs | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-) diff --git a/src/functions.rs b/src/functions.rs index a70f0a4..50300b1 100644 --- a/src/functions.rs +++ b/src/functions.rs @@ -344,11 +344,11 @@ impl<'a> PostScriptOp<'a> { fn write_slice(ops: &[Self], buf: &mut Vec) { buf.push(b'{'); if ops.len() > 1 { - buf.push(b'\n'); + buf.push(b' '); } for op in ops { op.write(buf); - buf.push(b'\n'); + buf.push(b' '); } if ops.len() == 1 { buf.pop(); @@ -362,14 +362,14 @@ impl<'a> PostScriptOp<'a> { Self::Integer(i) => buf.push_val(i), Self::If(ops) => { Self::write_slice(ops, buf); - buf.push(b'\n'); + buf.push(b' '); buf.extend(self.operator()); } Self::IfElse(ops1, ops2) => { Self::write_slice(ops1, buf); - buf.push(b'\n'); + buf.push(b' '); Self::write_slice(ops2, buf); - buf.push(b'\n'); + buf.push(b' '); buf.extend(self.operator()); } _ => buf.extend(self.operator()), @@ -447,7 +447,7 @@ mod tests { assert_eq!( PostScriptOp::encode(&ops), - b"{\n3.0\n2.0\nmul\nexch\ndup\n0.0\nge\n{\n1.0\nadd\n}\n{neg}\nifelse\nadd\n}" + b"{ 3.0 2.0 mul exch dup 0.0 ge { 1.0 add } {neg} ifelse add }" ); } }