--- rxvt-unicode/src/urxvt.pm 2006/01/07 21:22:02 1.47 +++ rxvt-unicode/src/urxvt.pm 2006/01/08 00:11:38 1.50 @@ -399,11 +399,14 @@ package urxvt; +use utf8; use strict; use Scalar::Util (); +use List::Util (); our $TERM; our @HOOKNAME; +our %OPTION; our $LIBDIR; BEGIN { @@ -479,8 +482,20 @@ if ($htype == 0) { # INIT my @dirs = ((split /:/, $TERM->resource ("perl_lib")), "$LIBDIR/perl"); + + my %want_ext; - for my $ext (map { split /,/, $TERM->resource ("perl_ext_$_") } 1, 2) { + for (map { split /,/, $TERM->resource ("perl_ext_$_") } 1, 2) { + if ($_ eq "default") { + $want_ext{$_}++ for qw(selection); + } elsif (/-(.*)/) { + delete $want_ext{$1}; + } else { + $want_ext{$_}++; + } + } + + for my $ext (keys %want_ext) { my @files = grep -f $_, map "$_/$ext", @dirs; if (@files) { @@ -564,6 +579,22 @@ Destroy the terminal object (close the window, free resources etc.). +=item $isset = $term->option ($optval[, $set]) + +Returns true if the option specified by C<$optval> is enabled, and +optionally change it. All option values are stored by name in the hash +C<%urxvt::OPTION>. Options not enabled in this binary are not in the hash. + +Here is a a likely non-exhaustive list of option names, please see the +source file F to see the actual list: + + borderLess console cursorBlink cursorUnderline hold iconic insecure + intensityStyles jumpScroll loginShell mapAlert meta8 mouseWheelScrollPage + pastableTabs pointerBlank reverseVideo scrollBar scrollBar_floating + scrollBar_right scrollTtyKeypress scrollTtyOutput scrollWithBuffer + secondaryScreen secondaryScroll skipBuiltinGlyphs transparent + tripleclickwords utmpInhibit visualBell + =item $value = $term->resource ($name[, $newval]) Returns the current resource value associated with a given name and @@ -582,8 +613,8 @@ terminal is destroyed, so changing options frequently will eat memory. Here is a a likely non-exhaustive list of resource names, not all of which -are supported in every build, please see the source to see the actual -list: +are supported in every build, please see the source file F +to see the actual list: answerbackstring backgroundPixmap backspace_key boldFont boldItalicFont borderLess color cursorBlink cursorUnderline cutchars delete_key @@ -1002,7 +1033,23 @@ sub add_button { my ($self, $text, $cb) = @_; - $self->add_item ({ type => "button", text => "[ $text ]", activate => $cb }); + $self->add_item ({ type => "button", text => "[ $text ]", activate => $cb, + render => sub { $_[0]{text} }, + }); +} + +sub add_toggle { + my ($self, $text, $cb, $value) = @_; + + my $item; $item = { + type => "button", + text => " $text", + value => $value, + render => sub { ($item->{value} ? "✔" : " ") . $text }, + activate => sub { $cb->($item->{value} = !$item->{value}); }, + }; + + $self->add_item ($item); } sub show {