--- rxvt-unicode/src/perl/keysym-list 2011/12/02 09:13:50 1.1 +++ rxvt-unicode/src/perl/keysym-list 2012/09/21 22:55:56 1.4 @@ -1,21 +1,37 @@ #! perl +=head1 NAME + +keysym-list - implement the "list" keysym expansion. + +=head1 SYNOPSIS + + urxvt -pe keysym-list + +=head1 DESCRIPTION + +The "list" keysym expansion was formerly part od the rxvt-unicode core, +and has been moved into this extension for backwards compatibility. You +shouldn't use this extension except for compatibility with old +configurations. + +=cut + + sub on_register_command { - my ($self, $keysym, $state, $str) = @_; + my ($self, $keysym, $state, $str) = @_; + + if ($str =~ /^list(.)/) { + my @list = split /\Q$1/, $str; + if (@list == 3 or @list == 4) { + $self->register_command ($keysym++, $state, "$list[1]$_$list[3]") + for split //, $list[2]; - if ($str =~ /^list(.)/) { - my @list = split /\Q$1/, $str; - if (@list == 4) { - for (0 .. (length $list[2]) - 1) { - my $middle = substr $list[2], $_, 1; - my $def = $list[1] . $middle . $list[3]; - $self->register_command ($keysym + $_, $state, $def); - } - return 1; - } + return 1; + } - warn "unable to parse keysym '$str' as list, processing as normal keysym\n"; - } + warn "unable to parse keysym '$str' as list, processing as normal keysym\n"; + } - () + () }