ViewVC Help
View File | Revision Log | Show Annotations | Download File
/cvs/rxvt-unicode/src/perl/mark-urls
(Generate patch)

Comparing rxvt-unicode/src/perl/mark-urls (file contents):
Revision 1.4 by root, Tue Jan 10 21:20:53 2006 UTC vs.
Revision 1.5 by root, Wed Jan 11 02:13:56 2006 UTC

4my $url = 4my $url =
5 qr{( 5 qr{(
6 (?:https?|ftp|news|mailto|file)://[ab-zA-Z0-9\-\@;\/?:&=%\$_.+!*\x27(),~]+ 6 (?:https?|ftp|news|mailto|file)://[ab-zA-Z0-9\-\@;\/?:&=%\$_.+!*\x27(),~]+
7 [ab-zA-Z0-9\-\@;\/?:&=%\$_+!*\x27()~] # exclude some trailing characters (heuristic) 7 [ab-zA-Z0-9\-\@;\/?:&=%\$_+!*\x27()~] # exclude some trailing characters (heuristic)
8 )}x; 8 )}x;
9
10sub on_start {
11 my ($self) = @_;
12
13 $self->{browser} = urxvt::untaint $self->x_resource ("urlLauncher") || "x-www-browser";
14}
9 15
10sub on_line_update { 16sub on_line_update {
11 my ($self, $row) = @_; 17 my ($self, $row) = @_;
12 18
13 # fetch the line that has changed 19 # fetch the line that has changed
27 } 33 }
28 34
29 () 35 ()
30} 36}
31 37
32# needs confgiurability TODO
33#sub on_button_press { 38sub on_button_press {
34# my ($self, $event) = @_; 39 my ($self, $event) = @_;
35# my $row = $event->{row}; 40 my $row = $event->{row};
36# my $col = $event->{col}; 41 my $col = $event->{col};
37#
38# my $line = $self->line ($row);
39# my $text = $line->t;
40#
41# while($text =~ /$url/g) {
42# #print "... " . ($-[0]
43# if ($-[0] <= $col && $+[0] >= $col) {
44# system "firefox \Q$1\E &";
45# return 1;
46# }
47# }
48# ()
49#}
50 42
43 my $line = $self->line ($row);
44 my $text = $line->t;
45
46 while($text =~ /$url/g) {
47 if ($-[0] <= $col && $+[0] >= $col) {
48 system "$self->{browser} \Q$1\E &";
49 return 1;
50 }
51 }
52 ()
53}
54

Diff Legend

Removed lines
+ Added lines
< Changed lines
> Changed lines