$line .= $j_part;
} else {
if (ref($p) and $p->[1] eq '(' and $p->[-1] eq ')') {
- push @res, $line.$join.'('."\n";
+ push @res, $line.($line =~ /S/ ? $join : '').'('."\n";
my (undef, undef, $inner) = @$p;
my $folded = $self->_fold_sql($indent, $indent, @$inner);
- push @res, $nl_post.$folded."\n";
- $line = $indent0.')';
+ push @res, $folded."\n";
+ $line = $indent0.')'.($nl_post and $idx < $#parts ? ' '.$nl_post : '');
next PART;
}
push @res, $line.$nl_pre."\n" if $line =~ /\S/;