X-Git-Url: http://git.shiar.nl/sheet.git/blobdiff_plain/2034c72e12562eda33ce53d92cfef2216b6fcf3e..b4ce208aa528529fbc34a035cf76b3f3e817e94a:/Shiar_Sheet/Keyboard.pm diff --git a/Shiar_Sheet/Keyboard.pm b/Shiar_Sheet/Keyboard.pm index 7607335..e8e33aa 100644 --- a/Shiar_Sheet/Keyboard.pm +++ b/Shiar_Sheet/Keyboard.pm @@ -5,7 +5,7 @@ use warnings; no warnings 'uninitialized'; # save some useless checks for more legible code use Carp; -our $VERSION = 'v2.00'; +our $VERSION = 'v2.03'; my @casedesc = (undef, qw/shift ctrl meta/, 'shift meta'); my @rowdesc = qw(numeric top home bottom); @@ -84,22 +84,21 @@ sub print_key { my $self = shift; my ($mode, $key, $flags) = @_; - my $txt = $self->{key}->{$mode.$key}; - my ($desc, $mnem) = defined $txt ? @$txt : (); - if (not defined $flags) { - $flags = $key eq '^0' ? 'ni' : 'no'; + $flags = [$key eq '^0' ? 'ni' : 'no']; } elsif (not ref $flags) { # alias - $desc = $self->{sign}->{alias} . $flags; - $flags = $self->keyunalias($flags) . ' alias'; + my $desc = $self->{sign}->{alias}; + $desc .= $flags eq "\e" ? 'esc' : $flags; + $flags = [$self->keyunalias($flags) . ' alias', $desc]; } - else { - $flags = $flags->[0]; + my ($flags, $desc, $mnem) = @{$flags}; + if (my $txt = $self->{key}->{$mode.$key}) { + ($desc, $mnem) = split /\n/, $txt; } # $key = $keytrans{$key} if defined $keytrans{$key}; - my $keytxt = $self->{def}{$mode}{lead} . escapehtml($key) if $key ne '^0'; + my $keytxt = $key eq "\e" ? 'Esc' : $self->{def}{$mode}{lead} . escapehtml($key) if $key ne '^0'; $keytxt .= $self->{sign}->{$1} while $flags =~ s/(?:^| )(arg[a-ln-z]?)\b//; # arguments $keytxt .= "$self->{sign}->{motion}" if $flags =~ s/ ?\bargm\b//; # motion argument $keytxt =~ s{\^(?=.)}{^}; # element around ctrl-identifier @@ -114,7 +113,7 @@ sub print_key { ); $flags .= ' chr'.ord(substr $key, -1) if $key ne '^0'; - print qq{\t\t
%s: %s | ', # XXX insert here to fix msie<=6 $self->{mode}->{$mode} || "mode $basemode", "$rowdesc[$row] row $casedesc[$case]" - ); - my $caseclass = 'keys'; - $caseclass .= ' lead' if defined $modekeys->{lead}; # leading command key shown - $caseclass .= " $casedesc[$case]" if defined $casedesc[$case]; - print qq{\t\t
---|