From 34bf120a3be82a36cb73fb90747c698e48831eb6 Mon Sep 17 00:00:00 2001 From: tpope Date: Sun, 10 Jun 2007 23:42:36 +0000 Subject: [PATCH] Fixed and documented matcher/on_user_command --- Changes | 3 ++- src/perl/matcher | 46 +++++++++++++++++++++++----------------------- src/urxvt.pm | 3 +++ 3 files changed, 28 insertions(+), 24 deletions(-) diff --git a/Changes b/Changes index 849abcd7..1743a1d0 100644 --- a/Changes +++ b/Changes @@ -38,7 +38,8 @@ TODO: rid of global dpy variable. digit. - better option handling, support more than 30 options (exg). - nuke reconf script, serves no purpose anymore. - - disabled matcher/on_user_command processing in matcher extension. + - fixed and documented matcher/on_user_command processing in matcher + extension. 8.2 Sat Feb 17 21:35:28 CET 2007 - fix make depend in src/, reported by exg. diff --git a/src/perl/matcher b/src/perl/matcher index a440daf3..4cd25de0 100644 --- a/src/perl/matcher +++ b/src/perl/matcher @@ -12,29 +12,29 @@ my $url = )+ }x; -#sub on_user_command { -# my ($self, $cmd) = @_; -# if($cmd =~ s/^matcher\b//) { -# $self->most_recent; -# } -# my $row = $self->nrow; -# my @exec; -# while($row-- > $self->top_row) { -# #my $line = $self->line ($row); -# #my $text = $line->t; -# @exec = $self->command_for($row); -# last if(@exec); -# } -# if(@exec) { -# return $self->exec_async (@exec); -# } -# () -#} -# -#sub most_recent { -# my ($self) = shift; -# () -#} +sub on_user_command { + my ($self, $cmd) = @_; + if($cmd =~ s/^matcher\b//) { + $self->most_recent; + } + () +} + +sub most_recent { + my ($self) = shift; + my $row = $self->nrow; + my @exec; + while($row-- > $self->top_row) { + #my $line = $self->line ($row); + #my $text = $line->t; + @exec = $self->command_for($row); + last if(@exec); + } + if(@exec) { + return $self->exec_async (@exec); + } + () +} sub my_resource { my $self = shift; diff --git a/src/urxvt.pm b/src/urxvt.pm index 87a01067..7c65698d 100644 --- a/src/urxvt.pm +++ b/src/urxvt.pm @@ -261,6 +261,9 @@ 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. +It is possible to activate the most recently seen match from the keyboard. +Simply bind a keysym to "perl:matcher" as seen in the example below. + Example configuration: URxvt.perl-ext: default,matcher -- 2.34.1