charset: unabbreviated row labels if misaligned
authorMischa POSLAWSKY <perl@shiar.org>
Thu, 6 Apr 2017 19:14:25 +0000 (21:14 +0200)
committerMischa POSLAWSKY <perl@shiar.org>
Mon, 24 Apr 2017 23:51:42 +0000 (01:51 +0200)
charset.plp

index db178d9bfb383514a2c6e51a97cbf28b6081b9dc..28c21c985c4e36ecb2c808ae7a6a029fd444b593 100644 (file)
@@ -161,7 +161,8 @@ for my $row (@request) {
        my $cols = $row->{cols};
        my $colsize = $row->{cell} && $row->{cell}->{colsize} || 1;
        my $coldigits = ceil(log($colsize * $cols) / log(16));  # uniform length of hexadecimal header
-       my $rowdiv = 16 ** $coldigits;  # divider of row headers
+       my $rowdiv = 16 ** $coldigits;  # row divide for column digits
+       $rowdiv = 1 if $rowdiv != $cols * $colsize;  # divide only if all columns are matched
        my $offset = 0;
        my $endpoint = $offset + (length($row->{table}) || 256) * $colsize;
 
@@ -171,7 +172,7 @@ for my $row (@request) {
        printf '<caption>%s</caption>', $title;
        print '<col>' x ($cols + 1);
        for my $section (qw{thead}) {
-               print "<$section><tr><th>↱";
+               print "<$section><tr><th>", $rowdiv == 1 ? '+' : '↱';
                printf '<th>%0*X', $coldigits, $_ * $colsize for 0 .. $cols - 1;
                print "\n";
        }