--- rxvt-unicode/src/urxvt.pm 2006/08/10 22:53:20 1.145 +++ rxvt-unicode/src/urxvt.pm 2007/01/09 16:18:56 1.152 @@ -242,12 +242,31 @@ See I in the @@RXVT_NAME@@(1) manpage for valid indices. -=item mark-urls +=item matcher -Uses per-line display filtering (C) to underline urls and -make them clickable. When middle-clicked, the program specified in the -resource C (default C) will be started with -the URL as first argument. +Uses per-line display filtering (C) to underline text +matching a certain pattern and make it clickable. When clicked with the +mouse button specified in the C resource (default 2, or +middle), the program specified in the C resource +(default, the C resource, C) will be started +with the matched text as first argument. The default configuration is +suitable for matching URLs and launching a web browser, like the +former "mark-urls" extension. + +The default pattern to match URLs can be overridden with the +C resource, and additional patterns can be specified +with numbered patterns, in a manner similar to the "selection" extension. +The launcher can also be overridden on a per-pattern basis. + +Example configuration: + + URxvt.perl-ext: default,matcher + URxvt.urlLauncher: sensible-browser + URxvt.keysym.C-Delete: perl:matcher + URxvt.matcher.button: 1 + URxvt.matcher.pattern.1: \\bwww\\.[\\w-]+\\.[\\w./?&@#-]*[\\w/-] + URxvt.matcher.pattern.2: \\B(/\\S+?):(\\d+)(?=:|$) + URxvt.matcher.launcher.2: gvim +$2 $1 =item xim-onthespot @@ -348,6 +367,11 @@ URxvt.selection-pastebin.url: http://www.ta-sa.org/files/txt/% +I xrdb uses the C preprocessor, which might interpret +the double C characters as comment start. Use C<\057\057> instead, +which works regardless of wether xrdb is used to parse the resource file +or not. + =item example-refresh-hooks Displays a very simple digital clock in the upper right corner of the @@ -969,6 +993,31 @@ SET_BGCOLOR (SET_FGCOLOR ($_[0], $_[1]), $_[2]) } +sub rend2mask { + no strict 'refs'; + my ($str, $mask) = (@_, 0); + my %color = ( fg => undef, bg => undef ); + my @failed; + for my $spec ( split /\s+/, $str ) { + if ( $spec =~ /^([fb]g)[_:-]?(\d+)/i ) { + $color{lc($1)} = $2; + } else { + my $neg = $spec =~ s/^[-^]//; + unless ( exists &{"RS_$spec"} ) { + push @failed, $spec; + next; + } + my $cur = &{"RS_$spec"}; + if ( $neg ) { + $mask &= ~$cur; + } else { + $mask |= $cur; + } + } + } + ($mask, @color{qw(fg bg)}, \@failed) +} + # urxvt::term::extension package urxvt::term::extension; @@ -1089,19 +1138,23 @@ } sub condvar { - bless \my $flag, urxvt::anyevent::condvar:: + bless \my $flag, urxvt::anyevent:: } -sub urxvt::anyevent::condvar::broadcast { +sub broadcast { ${$_[0]}++; } -sub urxvt::anyevent::condvar::wait { +sub wait { unless (${$_[0]}) { Carp::croak "AnyEvent->condvar blocking wait unsupported in urxvt, use a non-blocking API"; } } +sub one_event { + Carp::croak "AnyEvent->one_event blocking wait unsupported in urxvt, use a non-blocking API"; +} + package urxvt::term; =head2 The C Class @@ -1929,11 +1982,6 @@ package urxvt::watcher; -@urxvt::timer::ISA = __PACKAGE__; -@urxvt::iow::ISA = __PACKAGE__; -@urxvt::pw::ISA = __PACKAGE__; -@urxvt::iw::ISA = __PACKAGE__; - =head2 The C Class This class implements timer watchers/events. Time is represented as a @@ -2128,3 +2176,5 @@ =cut 1 + +# vim: sw=3: