From: Matt S Trout Date: Sun, 8 Sep 2019 23:56:42 +0000 (+0000) Subject: clearer formatting with less pointless whitespace/newlines X-Git-Tag: v2.000000~3^2~155 X-Git-Url: http://git.shadowcat.co.uk/gitweb/gitweb.cgi?a=commitdiff_plain;h=cb3a6230c15ddff5af9237e3574d6939f60a1fe5;p=dbsrgits%2FSQL-Abstract.git clearer formatting with less pointless whitespace/newlines --- diff --git a/lib/SQL/Abstract/Formatter.pm b/lib/SQL/Abstract/Formatter.pm index 42237fa..98566eb 100644 --- a/lib/SQL/Abstract/Formatter.pm +++ b/lib/SQL/Abstract/Formatter.pm @@ -52,13 +52,14 @@ sub _fold_sql { $line = $indent0.')'; next PART; } - push @res, $line.$nl_pre."\n"; + push @res, $line.$nl_pre."\n" if $line =~ /\S/; if (length($line = $indent.$nl_post.$j) <= $w) { next PART; } my $folded = $self->_fold_sql($indent, $next_indent, @$p); + $folded =~ s/\n\Z//; push @res, $folded.$pre."\n"; - $line = $indent.$nl_post; + $line = $idx == $#parts ? '' : $indent.$nl_post; } } return join '', @res, $line;