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

Comparing rxvt-unicode/src/perl/selection (file contents):
Revision 1.7 by root, Tue Jan 3 19:42:53 2006 UTC vs.
Revision 1.9 by root, Tue Jan 3 21:08:39 2006 UTC

7 and $self->selection (map { y/A-Za-z/N-ZA-Mn-za-m/; $_ } $self->selection); 7 and $self->selection (map { y/A-Za-z/N-ZA-Mn-za-m/; $_ } $self->selection);
8 8
9 () 9 ()
10} 10}
11 11
12my @patterns = (
13 # urls
14 qr{ ([a-z0-9.+\-]+://[ab-zA-Z0-9\-\@;\/?:&=%\$_.+!*\x27(),]+) }x,
15
16 # shell-like argument quoting
17 qr{\G\s*(
18 (?:
19 [^"'\\ \t]+
20 | \\.
21 | " ([^\\"]+ | \\. )* "
22 | ' [^']* '
23 )+
24 )}xs,
25);
26
12sub on_sel_extend { 27sub on_sel_extend {
13 my ($self) = @_; 28 my ($self) = @_;
14 warn $self->selection; 29
30 my ($row, $col) = $self->selection_mark;
31 my $line = $self->line ($row);
32 my $offset = $line->offset_of ($row, $col);
33 my $text = $line->t;
34
35 for my $regex (@patterns) {
36 while ($text =~ /$regex/g) {
37 if ($-[1] <= $offset and $offset <= $+[1]) {
38 $self->selection_beg ($line->coord_of ($-[1]));
39 $self->selection_end ($line->coord_of ($+[1]));
40 return 1;
41 }
42 }
43 }
44
15 () 45 ()
16} 46}

Diff Legend

Removed lines
+ Added lines
< Changed lines
> Changed lines