charset: fix cp437 offset on extend
authorMischa POSLAWSKY <perl@shiar.org>
Sat, 8 Apr 2017 21:32:50 +0000 (23:32 +0200)
committerMischa POSLAWSKY <perl@shiar.org>
Mon, 24 Apr 2017 23:51:41 +0000 (01:51 +0200)
charset.plp

index 33e5db4..74ea8e7 100644 (file)
@@ -226,7 +226,8 @@ sub tabinput {
                        $row{cols} = $1;
                }
                elsif ($param =~ m{ \A (?<offset> \d+) (?: [-] (?<endpoint> \d+) )? \z }x) {
-                       if ($row{offset}) {
+                       if (defined $row{endpoint}) {
+                               # extend earlier range
                                my $skip = int(($row{endpoint} || $row{offset}) / $row{cols});
                                for ($skip + 1 .. ($+{offset} / $row{cols}) - 1) {
                                        $row{skip}->{ $_ * $row{cols} - $row{offset} }++;
@@ -235,7 +236,7 @@ sub tabinput {
                        else {
                                $row{offset} = $+{offset};
                        }
-                       $row{endpoint} = $+{endpoint};
+                       $row{endpoint} = $+{endpoint} || 0;
                }
                else {
                        Alert("Unknown option <q>$param</q> for charset $input");