… | |
… | |
715 | @{ delete $TERM->{perl_ext_3} } |
715 | @{ delete $TERM->{perl_ext_3} } |
716 | ) { |
716 | ) { |
717 | if ($_ eq "default") { |
717 | if ($_ eq "default") { |
718 | |
718 | |
719 | $ext_arg{$_} = [] |
719 | $ext_arg{$_} = [] |
720 | for |
|
|
721 | qw(selection option-popup selection-popup readline searchable-scrollback), |
720 | for qw(selection option-popup selection-popup readline searchable-scrollback); |
722 | map $_->[0], values %{ $TERM->{meta}{binding} }; |
|
|
723 | |
721 | |
724 | for ($TERM->_keysym_resources) { |
722 | for ($TERM->_keysym_resources) { |
725 | next if /^(?:string|command|builtin|builtin-string|perl)/; |
723 | next if /^(?:string|command|builtin|builtin-string|perl)/; |
726 | next unless /^([A-Za-z0-9_\-]+):/; |
724 | next unless /^([A-Za-z0-9_\-]+):/; |
727 | |
725 | |
… | |
… | |
736 | } elsif (/^([^<]+)<(.*)>$/) { |
734 | } elsif (/^([^<]+)<(.*)>$/) { |
737 | push @{ $ext_arg{$1} }, $2; |
735 | push @{ $ext_arg{$1} }, $2; |
738 | |
736 | |
739 | } else { |
737 | } else { |
740 | $ext_arg{$_} ||= []; |
738 | $ext_arg{$_} ||= []; |
741 | } |
|
|
742 | } |
|
|
743 | |
|
|
744 | # now register default key bindings |
|
|
745 | for my $ext (sort keys %ext_arg) { |
|
|
746 | while (my ($k, $v) = each %{ $TERM->{meta}{ext}{$ext}{binding} }) { |
|
|
747 | $TERM->bind_action ($k, "$v->[0]:$v->[1]"); |
|
|
748 | } |
739 | } |
749 | } |
740 | } |
750 | |
741 | |
751 | for my $ext (sort keys %ext_arg) { |
742 | for my $ext (sort keys %ext_arg) { |
752 | my @files = grep -f $_, map "$_/$ext", @dirs; |
743 | my @files = grep -f $_, map "$_/$ext", @dirs; |
… | |
… | |
1170 | if ($pattern =~ /[^a-zA-Z0-9\-\.]/) { |
1161 | if ($pattern =~ /[^a-zA-Z0-9\-\.]/) { |
1171 | warn "$dir/$ext: meta resource '$pattern' contains illegal characters (not alphanumeric nor . nor *)\n"; |
1162 | warn "$dir/$ext: meta resource '$pattern' contains illegal characters (not alphanumeric nor . nor *)\n"; |
1172 | } else { |
1163 | } else { |
1173 | $ext{resource}{$pattern} = [$ext, $type, $desc]; |
1164 | $ext{resource}{$pattern} = [$ext, $type, $desc]; |
1174 | } |
1165 | } |
1175 | } elsif (/^#:META:BINDING:(.*)/) { |
|
|
1176 | my ($keysym, $action) = split /:/, $1; |
|
|
1177 | $ext{binding}{$keysym} = [$ext, $action]; |
|
|
1178 | } elsif (/^\s*(?:#|$)/) { |
1166 | } elsif (/^\s*(?:#|$)/) { |
1179 | # skip other comments and empty lines |
1167 | # skip other comments and empty lines |
1180 | } else { |
1168 | } else { |
1181 | last; # stop parsing on first non-empty non-comment line |
1169 | last; # stop parsing on first non-empty non-comment line |
1182 | } |
1170 | } |
… | |
… | |
1184 | |
1172 | |
1185 | $meta{ext}{$ext} = \%ext; |
1173 | $meta{ext}{$ext} = \%ext; |
1186 | } |
1174 | } |
1187 | } |
1175 | } |
1188 | |
1176 | |
1189 | # and now merge resources and bindings |
1177 | # and now merge resources |
1190 | while (my ($k, $v) = each %{ $meta{ext} }) { |
1178 | while (my ($k, $v) = each %{ $meta{ext} }) { |
1191 | #TODO: should check for extensions overriding each other |
1179 | #TODO: should check for extensions overriding each other |
1192 | %{ $meta{resource} } = (%{ $meta{resource} }, %{ $v->{resource} }); |
1180 | %{ $meta{resource} } = (%{ $meta{resource} }, %{ $v->{resource} }); |
1193 | %{ $meta{binding} } = (%{ $meta{binding} }, %{ $v->{binding} }); |
|
|
1194 | } |
1181 | } |
1195 | } |
1182 | } |
1196 | |
1183 | |
1197 | =item $term = new urxvt::term $envhashref, $rxvtname, [arg...] |
1184 | =item $term = new urxvt::term $envhashref, $rxvtname, [arg...] |
1198 | |
1185 | |