#!/usr/pkg/bin/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 of 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) = @_;

   if ($str =~ /^list(.)/) {
      my @list = split /\Q$1/, $str;
      if (@list == 3 or @list == 4) {
         $self->register_command ($keysym++, $state, "string:$list[1]$_$list[3]")
            for split //, $list[2];

         return 1;
      }

      warn "unable to parse keysym '$str' as list, processing as normal keysym\n";
   }

   ()
}
