… | |
… | |
10 | } |
10 | } |
11 | |
11 | |
12 | my @patterns = ( |
12 | my @patterns = ( |
13 | # urls |
13 | # urls |
14 | qr{ ([a-z0-9.+\-]+://[ab-zA-Z0-9\-\@;\/?:&=%\$_.+!*\x27(),]+) }x, |
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, |
15 | ); |
25 | ); |
16 | |
26 | |
17 | sub on_sel_extend { |
27 | sub on_sel_extend { |
18 | my ($self) = @_; |
28 | my ($self) = @_; |
19 | |
29 | |
… | |
… | |
22 | my $offset = $line->offset_of ($row, $col); |
32 | my $offset = $line->offset_of ($row, $col); |
23 | my $text = $line->t; |
33 | my $text = $line->t; |
24 | |
34 | |
25 | for my $regex (@patterns) { |
35 | for my $regex (@patterns) { |
26 | while ($text =~ /$regex/g) { |
36 | while ($text =~ /$regex/g) { |
27 | if ($-[0] <= $offset and $offset <= $+[0]) { |
37 | if ($-[1] <= $offset and $offset <= $+[1]) { |
28 | $self->selection_beg ($line->coord_of ($-[0])); |
38 | $self->selection_beg ($line->coord_of ($-[1])); |
29 | $self->selection_end ($line->coord_of ($+[0])); |
39 | $self->selection_end ($line->coord_of ($+[1])); |
30 | return 1; |
40 | return 1; |
31 | } |
41 | } |
32 | } |
42 | } |
33 | } |
43 | } |
34 | |
44 | |