From 8665c16469dd75189e709b0bd95a179e553e06a0 Mon Sep 17 00:00:00 2001 From: Mischa POSLAWSKY Date: Tue, 2 May 2017 22:36:47 +0200 Subject: [PATCH] termcol: reindent table handling code --- termcol.plp | 32 ++++++++++++++++---------------- 1 file changed, 16 insertions(+), 16 deletions(-) diff --git a/termcol.plp b/termcol.plp index a090fc7..3880a62 100644 --- a/termcol.plp +++ b/termcol.plp @@ -134,24 +134,24 @@ sub coltable { print coltable_hsv(@{$_}) for $info->{rgbmap} || (); if (my $table = $info->{table}) { - for my $row (@$table) { - if (!$row) { - say ''; - next; + for my $row (@$table) { + if (!$row) { + say ''; + next; + } + print ''; + print colcell(ref $_ ? @$_ : $_ ? reverse split /:/ : undef) for @$row; } - print ''; - print colcell(ref $_ ? @$_ : $_ ? reverse split /:/ : undef) for @$row; - } - if (@draw) { - my $width = scalar @{ $table->[0] }; - my @imgpal = map { - [ ref $_ ? @{$_}[1 .. 3] : map {hex} /(..)(..)(..)/ ] - } map { @{$_} } @{$table}; - for (@draw) { - print "", img_egapal(\@imgpal, @{$_}); - } - } + if (@draw) { + my $width = scalar @{ $table->[0] }; + my @imgpal = map { + [ ref $_ ? @{$_}[1 .. 3] : map {hex} /(..)(..)(..)/ ] + } map { @{$_} } @{$table}; + for (@draw) { + print "", img_egapal(\@imgpal, @{$_}); + } + } } say "\n"; -- 2.30.0