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

Comparing rxvt-unicode/src/perl/matcher (file contents):
Revision 1.34 by sf-exg, Tue Oct 14 09:00:43 2014 UTC vs.
Revision 1.35 by sf-exg, Tue Mar 17 09:25:16 2015 UTC

32 32
33It is possible to activate the most recently seen match or a list of matches 33It is possible to activate the most recently seen match or a list of matches
34from the keyboard. Simply bind a keysym to "matcher:last" or 34from 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
37The 'matcher:select' action enables a mode in which it is possible to 37The C<matcher:select> action enables a mode in which it is possible to
38iterate over the matches using the keyboard and either activate them 38iterate over the matches using the keyboard and either activate them
39or copy them to the clipboard. While the mode is active, normal terminal 39or copy them to the clipboard. While the mode is active, normal terminal
40input/output is suspended and the following bindings are recognized: 40input/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
70Copy the current match to the clipboard. 70Copy the current match to the clipboard.
71 71
72=back 72=back
73
74It is also possible to cycle through the matches using a key
75combination bound to the C<matcher:select> action.
73 76
74Example: load and use the matcher extension with defaults. 77Example: load and use the matcher extension with defaults.
75 78
76 URxvt.perl-ext: default,matcher 79 URxvt.perl-ext: default,matcher
77 80
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 (List::Util::min 0, $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
436sub select_refresh { 441sub 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

Diff Legend

Removed lines
+ Added lines
< Changed lines
> Changed lines