git.shiar.nl
/
sheet.git
/ blobdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
|
commitdiff
|
tree
raw
|
inline
| side by side
keys: move key definitions into translation includes
[sheet.git]
/
Shiar_Sheet
/
Keyboard.pm
diff --git
a/Shiar_Sheet/Keyboard.pm
b/Shiar_Sheet/Keyboard.pm
index 2b3cc8629e8033d0d818dfd008b6e7efafb16418..c5fdb09fdb7fa37bc28272c8f25ac2c21931195b 100644
(file)
--- a/
Shiar_Sheet/Keyboard.pm
+++ b/
Shiar_Sheet/Keyboard.pm
@@
-6,7
+6,7
@@
use warnings;
no warnings 'uninitialized'; # save some useless checks for more legible code
use Carp;
no warnings 'uninitialized'; # save some useless checks for more legible code
use Carp;
-our $VERSION = 'v2.0
5
';
+our $VERSION = 'v2.0
6
';
my @casedesc = (undef, qw/shift ctrl meta/, 'shift meta');
my @rowdesc = qw(numeric top home bottom);
my @casedesc = (undef, qw/shift ctrl meta/, 'shift meta');
my @rowdesc = qw(numeric top home bottom);
@@
-125,11
+125,13
@@
sub print_key {
sub print_rows {
my $self = shift;
sub print_rows {
my $self = shift;
+ my ($rowsspec, $defrows) = @_;
+ $defrows ||= [2, 1, 0];
my %moderows = (
my %moderows = (
- -DEFAULT => !!@_ && $_[0] ne '' && split(/(?:\s*([^=\s]*)=\s*)/, shift),
+ -DEFAULT => defined $rowsspec && $rowsspec ne '' &&
+ split(/\s* ([^=\s]*) = \s*/x, $rowsspec),
# plus specific mode overrides prefixed by '='
);
# plus specific mode overrides prefixed by '='
);
- my $defrows = shift || [2, 1, 0];
my @modes = sort keys %{ $self->{def} };
print '<table id="rows" class="keys">'."\n\n";
my @modes = sort keys %{ $self->{def} };
print '<table id="rows" class="keys">'."\n\n";
@@
-140,8
+142,8
@@
sub print_rows {
printf qq{<tbody class="row row%d">\n}, $row+1;
for my $basemode (@modes) {
my @moderows = split /\s+/,
printf qq{<tbody class="row row%d">\n}, $row+1;
for my $basemode (@modes) {
my @moderows = split /\s+/,
- $row < 0 ?
"0" :
-
defined $moderows{$basemode} ? $moderows{$basemode} :
$moderows{-DEFAULT};
+ $row < 0 ?
'1' : # top row (esc key) always unshifted
+
$moderows{$basemode} //
$moderows{-DEFAULT};
for my $submode (@moderows ? @moderows : '') {
my $mode = $basemode . $submode;
for my $submode (@moderows ? @moderows : '') {
my $mode = $basemode . $submode;