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.3 by root, Fri Jan 6 01:16:58 2006 UTC vs.
Revision 1.4 by root, Tue Jan 10 21:20:53 2006 UTC

2 2
3# same url as used in "selection" 3# same url as used in "selection"
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(),~] # do not include a trailing dot, its wrong too often 7 [ab-zA-Z0-9\-\@;\/?:&=%\$_+!*\x27()~] # exclude some trailing characters (heuristic)
8 )}x; 8 )}x;
9 9
10sub on_line_update { 10sub on_line_update {
11 my ($term, $row) = @_; 11 my ($self, $row) = @_;
12 12
13 # fetch the line that has changed 13 # fetch the line that has changed
14 my $line = $term->line ($row); 14 my $line = $self->line ($row);
15 my $text = $line->t; 15 my $text = $line->t;
16 16
17 # find all urls (if any) 17 # find all urls (if any)
18 while ($text =~ /$url/g) { 18 while ($text =~ /$url/g) {
19 my $rend = $line->r; 19 my $rend = $line->r;
27 } 27 }
28 28
29 () 29 ()
30} 30}
31 31
32# needs confgiurability TODO
33#sub on_button_press {
34# my ($self, $event) = @_;
35# my $row = $event->{row};
36# 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

Diff Legend

Removed lines
+ Added lines
< Changed lines
> Changed lines