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.10 by root, Tue Jan 31 15:28:40 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} = $self->x_resource ("urlLauncher") || "x-www-browser";
14
15 ()
16}
9 17
10sub on_line_update { 18sub on_line_update {
11 my ($self, $row) = @_; 19 my ($self, $row) = @_;
12 20
13 # fetch the line that has changed 21 # fetch the line that has changed
27 } 35 }
28 36
29 () 37 ()
30} 38}
31 39
32# needs confgiurability TODO
33#sub on_button_press { 40sub on_button_release {
34# my ($self, $event) = @_; 41 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 42
43 my $mask = $self->ModLevel3Mask | $self->ModMetaMask
44 | urxvt::ShiftMask | urxvt::ControlMask;
45
46 if ($event->{button} == 2 && ($event->{state} & $mask) == 0) {
47 my $row = $event->{row};
48 my $col = $event->{col};
49
50 my $line = $self->line ($row);
51 my $text = $line->t;
52
53 while ($text =~ /$url/g) {
54 if ($-[1] <= $col && $+[1] >= $col) {
55 $self->exec_async ($self->{browser}, $1);
56 return 1;
57 }
58 }
59 }
60
61 ()
62}
63

Diff Legend

Removed lines
+ Added lines
< Changed lines
> Changed lines