charset: persistent data of unicode cell include
[sheet.git] / charset.plp
index 5b415eec8387bb6cf6b76e81f7ae3c52d9093f5e..6ec4a242986f85ef4475ae7b9441729995fe0f03 100644 (file)
@@ -152,7 +152,7 @@ sub tabinput {
        if ($row{set}) {}
        elsif ($row{set} = Encode::resolve_alias($input)) {
                $row{offset} = delete $row{startpoint};
-               if ($row{set} eq 'MacHebrew' or $row{set} eq 'MacThai') {
+               if ($charset->{varchar}) {
                        # array of possibly multiple characters per code point
                        $row{table} = [
                                map { Encode::decode($row{set}, pack 'C*', $_) } $row{offset} .. $row{endpoint}
@@ -178,6 +178,12 @@ sub tabinput {
                while (my ($offset, $sub) = each %{$replace}) {
                        $offset -= $row{offset};
 
+                       if (ref $row{table} eq 'ARRAY') {
+                               $row{table}->[$offset] = $sub
+                                       if $offset >= 0 and $offset <= $row{endpoint};
+                               next;
+                       }
+
                        my $length = length $sub;
 
                        if ($offset < 0) {