From: Matt S Trout Date: Mon, 16 Sep 2019 19:22:41 +0000 (+0000) Subject: better indent picking inside parens X-Git-Url: http://git.shadowcat.co.uk/gitweb/gitweb.cgi?a=commitdiff_plain;h=9046a418c7377ede3d99d1450158cde55a3bab26;p=scpubgit%2FQ-Branch.git better indent picking inside parens --- diff --git a/lib/SQL/Abstract/Formatter.pm b/lib/SQL/Abstract/Formatter.pm index efbd912..4b1dc3c 100644 --- a/lib/SQL/Abstract/Formatter.pm +++ b/lib/SQL/Abstract/Formatter.pm @@ -48,9 +48,12 @@ sub _fold_sql { } if (ref($p) and $p->[1] eq '(' and $p->[-1] eq ')') { my $already = !($line eq $indent0 or $line eq $line_orig); + my $innerdent = @res + ? $next_indent + : $indent0.$self->indent_by; push @res, $line.($already ? $join : '').'('."\n"; my (undef, undef, $inner) = @$p; - my $folded = $self->_fold_sql($next_indent, $next_indent, @$inner); + my $folded = $self->_fold_sql($innerdent, $innerdent, @$inner); $folded =~ s/\n\Z//; push @res, $folded."\n"; $line_orig = $line