keyboard/altgr/ipa: hide identical keys
authorMischa POSLAWSKY <perl@shiar.org>
Fri, 16 Feb 2024 21:51:25 +0000 (22:51 +0100)
committerMischa POSLAWSKY <perl@shiar.org>
Wed, 28 Feb 2024 23:40:02 +0000 (00:40 +0100)
Fix being classified as g1 mode switch.

Shiar_Sheet/KeyboardChars.pm

index e2822cd05eeff6dec029b920058161f586772b28..b2ee11d615c7ade7d5bd1ed403e38cc22e56e73e 100644 (file)
@@ -9,7 +9,7 @@ use Unicode::Normalize qw( NFKD );
 use Text::Unidecode ();
 use Shiar_Sheet::FormatChar;
 
-our $VERSION = '1.03';
+our $VERSION = '1.04';
 our @EXPORT = qw( kbchars kbmodes );
 
 my $uc = Shiar_Sheet::FormatChar->new;
@@ -52,17 +52,17 @@ sub kbmodes ($modes) {
                        $info{key}{$lead.$k} = join "\n", $glyph, $title;
                        my $c = $k =~ s/\A[+^](?=.)//r;  # trim modifier indicator
 
-                       my $class = 'g'.(
-                                 !defined $v || $c eq $v ? 1 # identical
-                               : $v =~ /\A\p{Mn}+\z/ ? 9 # combining accent
-                               : NFKD($v) =~ /\Q$c/ ? 2 # decomposed equivalent
-                               : unidecode($v) =~ /\Q$c\E+/i ? 4 # transliterated
-                               : $v =~ /\A[\p{Sk}\p{Lm}]+\z/ ? 8 # modifier symbol
-                               : $v =~ /\A[\pM\pP]+\z/ ? 7 # mark
-                               : $v =~ /^\p{Latin}/ ? 5 # latin script
-                               : 6
+                       my $class = (
+                                 !defined $v || $c eq $v ? 'no' # identical
+                               : $v =~ /\A\p{Mn}+\z/ ? 'g9' # combining accent
+                               : NFKD($v) =~ /\Q$c/ ? 'g2' # decomposed equivalent
+                               : unidecode($v) =~ /\Q$c\E+/i ? 'g4' # transliterated
+                               : $v =~ /\A[\p{Sk}\p{Lm}]+\z/ ? 'g8' # modifier symbol
+                               : $v =~ /\A[\pM\pP]+\z/ ? 'g7' # mark
+                               : $v =~ /^\p{Latin}/ ? 'g5' # latin script
+                               : 'g6'
                        );
-                       $g{$class} = 1;
+                       $g{$class} = 1 unless $class eq 'no';
                        $info{def}{$lead}{$k} //= $class;
                }
        }