From: Matt S Trout Date: Sun, 8 Sep 2019 23:56:42 +0000 (+0000) Subject: clearer formatting with less pointless whitespace/newlines X-Git-Url: http://git.shadowcat.co.uk/gitweb/gitweb.cgi?p=scpubgit%2FQ-Branch.git;a=commitdiff_plain;h=4a9ad1af65dd94ff2b6f2d8a147e9ba19cf5dab8 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;