charset: compare option to indicate differences with parent
[sheet.git] / charset.plp
index 5e16116a412cbb606dc5d0e6c1602175b1833bdd..49ee2e70df847938e92f1cd66f30a80de2f00d73 100644 (file)
@@ -323,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 {