charset: compare option to indicate differences with parent
[sheet.git] / charset.plp
index 5668225b2512169914da35586d3592992119f63c..49ee2e70df847938e92f1cd66f30a80de2f00d73 100644 (file)
@@ -139,7 +139,9 @@ sub tabinput {
 
                if (my ($parent, $part) = pairfirst { defined $visible->{$a} } @parents) {
                        $row{parent} = $parent;
-                       $params = $visible->{$parent} ? $part : 128;
+                       $params = $part;
+                       $params = 128 unless $visible->{$parent}
+                               or ($input eq 'MacCroatian' and defined $visible->{MacRomanian});
                }
                elsif (defined $visible->{ascii}) {
                        $row{parent} = $parents[0];
@@ -321,6 +323,20 @@ for my $row (@request) {
                                next;
                        }
 
+                       if (exists $get{compare}) {
+                               state $visible = {};
+                               my $cp = $offset + $row->{offset};
+                               printf '<td class="%s" title="%3$s">%2$s',
+                                       $cp == ord $glyph ? 'l4' :
+                                       $row->{parent} && $glyph eq
+                                               Encode::decode($row->{parent}, pack 'C', $cp) ? 'l3' :
+                                       $visible->{$glyph} ? 'l2' :
+                                       'l1',
+                                       $glyphs->glyph_html($glyph);
+                               $visible->{$glyph}++;
+                               next;
+                       }
+
                        print "\n".$glyphs->glyph_cell($glyph);
                }
                continue {