… | |
… | |
37 | The C<matcher:select> action enables a mode in which it is possible to |
37 | The C<matcher:select> action enables a mode in which it is possible to |
38 | iterate over the matches using the keyboard and either activate them |
38 | iterate over the matches using the keyboard and either activate them |
39 | or copy them to the clipboard. While the mode is active, normal terminal |
39 | or copy them to the clipboard. While the mode is active, normal terminal |
40 | input/output is suspended and the following bindings are recognized: |
40 | input/output is suspended and the following bindings are recognized: |
41 | |
41 | |
42 | =over 4 |
42 | =over |
43 | |
43 | |
44 | =item C<Up> |
44 | =item C<Up> |
45 | |
45 | |
46 | Search for a match upwards. |
46 | Search for a match upwards. |
47 | |
47 | |
… | |
… | |
91 | =cut |
91 | =cut |
92 | |
92 | |
93 | my $url = |
93 | my $url = |
94 | qr{ |
94 | qr{ |
95 | (?:https?://|ftp://|news://|mailto:|file://|\bwww\.) |
95 | (?:https?://|ftp://|news://|mailto:|file://|\bwww\.) |
96 | [\w\-\@;\/?:&=%\$.+!*\x27,~#]* |
96 | [\w\-\@;\/?:&=%\$.+!*\x27,~#$urxvt::NOCHAR]* |
97 | ( |
97 | ( |
98 | \([\w\-\@;\/?:&=%\$.+!*\x27,~#]*\)| # Allow a pair of matched parentheses |
98 | \([\w\-\@;\/?:&=%\$.+!*\x27,~#$urxvt::NOCHAR]*\)| # Allow a pair of matched parentheses |
99 | [\w\-\@;\/?:&=%\$+*~] # exclude some trailing characters (heuristic) |
99 | [\w\-\@;\/?:&=%\$+*~] # exclude some trailing characters (heuristic) |
100 | )+ |
100 | )+ |
101 | }x; |
101 | }x; |
102 | |
102 | |
103 | sub matchlist_key_press { |
103 | sub matchlist_key_press { |
… | |
… | |
251 | } |
251 | } |
252 | } |
252 | } |
253 | |
253 | |
254 | my @defaults = ($url); |
254 | my @defaults = ($url); |
255 | my @matchers; |
255 | my @matchers; |
256 | for (my $idx = 0; defined (my $res = $self->my_resource ("pattern.$idx") || $defaults[$idx]); $idx++) { |
256 | for (my $idx = 0; defined (my $res = $self->locale_decode ($self->my_resource ("pattern.$idx")) || $defaults[$idx]); $idx++) { |
257 | $res = $self->locale_decode ($res); |
|
|
258 | utf8::encode $res; |
|
|
259 | my $launcher = $self->my_resource ("launcher.$idx"); |
257 | my $launcher = $self->my_resource ("launcher.$idx"); |
260 | $launcher =~ s/\$&|\$\{&\}/\${0}/g if $launcher; |
258 | $launcher =~ s/\$&|\$\{&\}/\${0}/g if $launcher; |
261 | my $rend = $self->parse_rend($self->my_resource ("rend.$idx")); |
259 | my $rend = $self->parse_rend($self->my_resource ("rend.$idx")); |
262 | unshift @matchers, [qr($res)x,$launcher,$rend]; |
260 | unshift @matchers, [qr($res)x,$launcher,$rend]; |
263 | } |
261 | } |
… | |
… | |
423 | if (@matches) { |
421 | if (@matches) { |
424 | @matches = sort { $a->[0] <=> $b->[0] or $a->[1] <=> $b->[1] } @matches; |
422 | @matches = sort { $a->[0] <=> $b->[0] or $a->[1] <=> $b->[1] } @matches; |
425 | $self->{matches} = \@matches; |
423 | $self->{matches} = \@matches; |
426 | $self->{cur_row} = $row; |
424 | $self->{cur_row} = $row; |
427 | $self->{id} = $dir < 0 ? @{ $self->{matches} } - 1 : 0; |
425 | $self->{id} = $dir < 0 ? @{ $self->{matches} } - 1 : 0; |
428 | $self->view_start (List::Util::min 0, $row - ($self->nrow >> 1)); |
426 | $self->view_start ($row - ($self->nrow >> 1)); |
429 | $self->want_refresh; |
427 | $self->want_refresh; |
430 | return 1; |
428 | return 1; |
431 | } |
429 | } |
432 | |
430 | |
433 | $row = $dir < 0 ? $line->beg - 1 : $line->end + 1; |
431 | $row = $dir < 0 ? $line->beg - 1 : $line->end + 1; |