File tree Expand file tree Collapse file tree
Expand file tree Collapse file tree Original file line number Diff line number Diff line change @@ -109,7 +109,12 @@ impl<'a> Operation<'a> {
109109 true
110110 }
111111 } else {
112- false
112+ if self . write_settings . pretty {
113+ self . buf . push ( b'\n' ) ;
114+ false
115+ } else {
116+ true
117+ }
113118 } ;
114119
115120 self . first = false ;
@@ -126,9 +131,14 @@ impl Drop for Operation<'_> {
126131 {
127132 self . buf . push ( b' ' ) ;
128133 }
134+ } else {
135+ if self . write_settings . pretty
136+ || self . buf . last ( ) . is_some_and ( |b| !is_delimiter_character ( * b) )
137+ {
138+ self . buf . push ( b'\n' ) ;
139+ }
129140 }
130141 self . buf . extend ( self . op . as_bytes ( ) ) ;
131- self . buf . push ( b'\n' ) ;
132142 }
133143}
134144
@@ -1760,7 +1770,7 @@ mod tests {
17601770
17611771 assert_eq ! (
17621772 content. finish( ) . into_vec( ) ,
1763- b"/F1 12 Tf\n /F2 15 Tf\n BT\n []TJ\n [(AB)2(CD)4(EF)]TJ\n ET"
1773+ b"/F1 12 Tf/F2 15 Tf\n BT[]TJ[(AB)2(CD)4(EF)]TJ\n ET"
17641774 ) ;
17651775 }
17661776 #[ test]
You can’t perform that action at this time.
0 commit comments