--- rxvt-unicode/src/urxvt.pm 2014/05/17 15:33:24 1.235 +++ rxvt-unicode/src/urxvt.pm 2014/05/18 18:15:04 1.238 @@ -677,20 +677,44 @@ } for ( - @{ delete $TERM->{perl_ext_3} }, grep $_, map { split /,/, $TERM->resource ("perl_ext_$_") } 1, 2 ) { if ($_ eq "default") { - $ext_arg{$_} ||= [] for qw(selection option-popup selection-popup searchable-scrollback readline); + + $ext_arg{$_} = [] + for + qw(selection option-popup selection-popup readline), + map $_->[0], values %{ $TERM->{meta}{binding} }, + @{ delete $TERM->{perl_ext_3} }; + + for ($TERM->_keysym_resources) { + next if /^(?:string|command|builtin|builtin-string|perl)/; + next unless /^([A-Za-z0-9_\-]+):/; + + my $ext = $1; + $ext =~ y/-/_/; + + $ext_arg{$ext} = []; + } + } elsif (/^-(.*)$/) { delete $ext_arg{$1}; + } elsif (/^([^<]+)<(.*)>$/) { push @{ $ext_arg{$1} }, $2; + } else { $ext_arg{$_} ||= []; } } + # now register default key bindings + for my $ext (sort keys %ext_arg) { + while (my ($k, $v) = each %{ $TERM->{meta}{ext}{$ext}{binding} }) { + $TERM->bind_action ($k, "$v->[0]:$v->[1]"); + } + } + for my $ext (sort keys %ext_arg) { my @files = grep -f $_, map "$_/$ext", @dirs; @@ -1081,14 +1105,10 @@ my @libdirs = perl_libdirs $self; - return if $self->{meta_libdirs} eq join "\x00", @libdirs; - - my %meta; - - $self->{meta_libdirs} = join "\x00", @libdirs; - $self->{meta} = \%meta; +# return if $self->{meta_libdirs} eq join "\x00", @libdirs;#d# - my %ext; +# $self->{meta_libdirs} = join "\x00", @libdirs;#d# + $self->{meta} = \my %meta; # first gather extensions for my $dir (reverse @libdirs) { @@ -1112,7 +1132,7 @@ } } elsif (/^#:META:BINDING:(.*)/) { my ($keysym, $action) = split /:/, $1; - $ext{binding}{$keysym} = $action; + $ext{binding}{$keysym} = [$ext, $action]; } elsif (/^\s*(?:#|$)/) { # skip other comments and empty lines } else { @@ -1120,12 +1140,12 @@ } } - $meta{$ext} = \%ext; + $meta{ext}{$ext} = \%ext; } } # and now merge resources and bindings - while (my ($k, $v) = each %ext) { + while (my ($k, $v) = each %{ $meta{ext} }) { #TODO: should check for extensions overriding each other %{ $meta{resource} } = (%{ $meta{resource} }, %{ $v->{resource} }); %{ $meta{binding} } = (%{ $meta{binding} }, %{ $v->{binding} });