charset: avoid misaligned override of offset cp437
[sheet.git] / charset.plp
index 7794284f7ff685f4db1f6ef2279a249841dfc76b..486fece03a3b837cde1f92d94ec69dfe7fa768ce 100644 (file)
@@ -24,6 +24,7 @@ my @tablist = split /[^\w-]+/, $Request || 'default';
 use POSIX qw( ceil );
 use Shiar_Sheet::FormatChar;
 my $glyphs = Shiar_Sheet::FormatChar->new;
+my @request;
 
 sub tabinput {
        # generate character table(s)
@@ -59,7 +60,8 @@ sub tabinput {
                11 => 'thai',
        };
        if (my $follow = $ALIAS->{$input}) {
-               return map { tabinput($_) } ref $follow ? @{$follow} : $follow;
+               tabinput($_) for ref $follow ? @{$follow} : $follow;
+               return;
        }
 
        my %row = (offset => 0, cols => 16);
@@ -107,7 +109,7 @@ sub tabinput {
                                # (~16x faster than decoding in loop;
                                #  substr strings is twice as fast as splitting to an array)
 
-                       if ($row{set} eq 'cp437') {
+                       if ($row{set} eq 'cp437' and !$row{offset}) {
                                substr($row{table}, 237, 1) = pack 'U*', 0x3D5; # phi sign
                                substr($row{table}, 0, 32) = pack 'U*', map {hex} qw(
                                        2007 263A 263B 2665 2666 2663 2660 2022
@@ -122,9 +124,9 @@ sub tabinput {
                Alert("Encoding <q>$input</q> unknown");
                return;
        }
-       return \%row;
+       push @request, \%row;
 }
-my @request = map { tabinput($_) } @tablist;
+tabinput($_) for @tablist;
 
 my $NOCHAR = chr 0xFFFD;