From: Mischa POSLAWSKY Date: Fri, 16 Feb 2024 21:51:25 +0000 (+0100) Subject: keyboard/altgr/ipa: hide identical keys X-Git-Url: http://git.shiar.net/sheet.git/commitdiff_plain/ed1c096fecf0abce1d1d061f5b9f7cb5fbef7645 keyboard/altgr/ipa: hide identical keys Fix being classified as g1 mode switch. --- diff --git a/Shiar_Sheet/KeyboardChars.pm b/Shiar_Sheet/KeyboardChars.pm index e2822cd..b2ee11d 100644 --- a/Shiar_Sheet/KeyboardChars.pm +++ b/Shiar_Sheet/KeyboardChars.pm @@ -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; } }