--- rxvt-unicode/src/perl/mark-urls 2006/01/10 21:20:53 1.4 +++ rxvt-unicode/src/perl/mark-urls 2006/01/12 01:30:53 1.6 @@ -7,6 +7,12 @@ [ab-zA-Z0-9\-\@;\/?:&=%\$_+!*\x27()~] # exclude some trailing characters (heuristic) )}x; +sub on_start { + my ($self) = @_; + + $self->{browser} = urxvt::untaint $self->x_resource ("urlLauncher") || "x-www-browser"; +} + sub on_line_update { my ($self, $row) = @_; @@ -29,22 +35,23 @@ () } -# needs confgiurability TODO -#sub on_button_press { -# my ($self, $event) = @_; -# my $row = $event->{row}; -# my $col = $event->{col}; -# -# my $line = $self->line ($row); -# my $text = $line->t; -# -# while($text =~ /$url/g) { -# #print "... " . ($-[0] -# if ($-[0] <= $col && $+[0] >= $col) { -# system "firefox \Q$1\E &"; -# return 1; -# } -# } -# () -#} +sub on_button_release { + my ($self, $event) = @_; + my $row = $event->{row}; + my $col = $event->{col}; + + my $line = $self->line ($row); + my $text = $line->t; + + if ($event->{button} == 2) { + while ($text =~ /$url/g) { + if ($-[0] <= $col && $+[0] >= $col) { + system "$self->{browser} \Q$1\E &"; + return 1; + } + } + } + + () +}