… | |
… | |
32 | |
32 | |
33 | It is possible to activate the most recently seen match or a list of matches |
33 | It is possible to activate the most recently seen match or a list of matches |
34 | from the keyboard. Simply bind a keysym to "matcher:last" or |
34 | from the keyboard. Simply bind a keysym to "matcher:last" or |
35 | "matcher:list" as seen in the example below. |
35 | "matcher:list" as seen in the example below. |
36 | |
36 | |
37 | The '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 4 |
… | |
… | |
68 | =item C<y> |
68 | =item C<y> |
69 | |
69 | |
70 | Copy the current match to the clipboard. |
70 | Copy the current match to the clipboard. |
71 | |
71 | |
72 | =back |
72 | =back |
|
|
73 | |
|
|
74 | It is also possible to cycle through the matches using a key |
|
|
75 | combination bound to the C<matcher:select> action. |
73 | |
76 | |
74 | Example: load and use the matcher extension with defaults. |
77 | Example: load and use the matcher extension with defaults. |
75 | |
78 | |
76 | URxvt.perl-ext: default,matcher |
79 | URxvt.perl-ext: default,matcher |
77 | |
80 | |
… | |
… | |
420 | if (@matches) { |
423 | if (@matches) { |
421 | @matches = sort { $a->[0] <=> $b->[0] or $a->[1] <=> $b->[1] } @matches; |
424 | @matches = sort { $a->[0] <=> $b->[0] or $a->[1] <=> $b->[1] } @matches; |
422 | $self->{matches} = \@matches; |
425 | $self->{matches} = \@matches; |
423 | $self->{cur_row} = $row; |
426 | $self->{cur_row} = $row; |
424 | $self->{id} = $dir < 0 ? @{ $self->{matches} } - 1 : 0; |
427 | $self->{id} = $dir < 0 ? @{ $self->{matches} } - 1 : 0; |
425 | $self->view_start (List::Util::min 0, $row - ($self->nrow >> 1)); |
428 | $self->view_start ($row - ($self->nrow >> 1)); |
426 | $self->want_refresh; |
429 | $self->want_refresh; |
427 | return; |
430 | return 1; |
428 | } |
431 | } |
429 | |
432 | |
430 | $row = $dir < 0 ? $line->beg - 1 : $line->end + 1; |
433 | $row = $dir < 0 ? $line->beg - 1 : $line->end + 1; |
431 | } |
434 | } |
432 | |
435 | |
433 | $self->scr_bell; |
436 | $self->scr_bell; |
|
|
437 | |
|
|
438 | () |
434 | } |
439 | } |
435 | |
440 | |
436 | sub select_refresh { |
441 | sub select_refresh { |
437 | my ($self) = @_; |
442 | my ($self) = @_; |
438 | |
443 | |
… | |
… | |
482 | } else { |
487 | } else { |
483 | my $line = $self->line ($self->{cur_row}); |
488 | my $line = $self->line ($self->{cur_row}); |
484 | $self->select_search (+1, $line->end + 1) |
489 | $self->select_search (+1, $line->end + 1) |
485 | if $line->end < $self->nrow; |
490 | if $line->end < $self->nrow; |
486 | } |
491 | } |
|
|
492 | } elsif ($self->lookup_keysym ($keysym, $event->{state}) eq "matcher:select") { |
|
|
493 | if ($self->{id} > 0) { |
|
|
494 | $self->{id}--; |
|
|
495 | $self->want_refresh; |
|
|
496 | } else { |
|
|
497 | my $line = $self->line ($self->{cur_row}); |
|
|
498 | $self->select_search (-1, $self->nrow - 1) |
|
|
499 | unless $self->select_search (-1, $line->beg - 1); |
|
|
500 | } |
487 | } |
501 | } |
488 | |
502 | |
489 | 1 |
503 | 1 |
490 | } |
504 | } |
491 | |
505 | |