searchable-scrollback (rxvt-unicode-9.26.tar.bz2) | : | searchable-scrollback (rxvt-unicode-9.29.tar.bz2) | ||
---|---|---|---|---|
#! perl | #! perl | |||
# this extension implements scrollback buffer search | # this extension implements scrollback buffer search | |||
#:META:RESOURCE:%:string:activation hotkey keysym | #:META:RESOURCE:%:string:activation hotkey keysym | |||
=head1 NAME | =head1 NAME | |||
searchable-scrollback - incremental scrollback search (enabled by default) | searchable-scrollback - incremental scrollback search | |||
=head1 DESCRIPTION | =head1 DESCRIPTION | |||
Adds regex search functionality to the scrollback buffer, triggered by | Adds regex search functionality to the scrollback buffer, triggered by | |||
the C<searchable-scrollback:start> action (bound to C<M-s> by | the C<searchable-scrollback:start> action (bound to C<M-s> by | |||
default). While in search mode, normal terminal input/output is | default). While in search mode, normal terminal input/output is | |||
suspended and a regex is displayed at the bottom of the screen. | suspended and a regex is displayed at the bottom of the screen. | |||
Inputting characters appends them to the regex and continues incremental | Inputting characters appends them to the regex and continues incremental | |||
search. In addition, the following bindings are recognized: | search. In addition, the following bindings are recognized: | |||
=over 4 | =over | |||
=item C<BackSpace> | =item C<BackSpace> | |||
Remove a character from the regex. | Remove a character from the regex. | |||
=item C<Insert> | =item C<Insert> | |||
Append the value of the PRIMARY selection to the regex. | Append the value of the PRIMARY selection to the regex. | |||
=item C<Up> | =item C<Up> | |||
skipping to change at line 171 | skipping to change at line 171 | |||
my $text = $line->t; | my $text = $line->t; | |||
if ($text =~ /$re/g) { | if ($text =~ /$re/g) { | |||
delete $self->{found}; | delete $self->{found}; | |||
do { | do { | |||
push @{ $self->{found} }, [$line->coord_of ($-[0]), $line->coord_ of ($+[0])]; | push @{ $self->{found} }, [$line->coord_of ($-[0]), $line->coord_ of ($+[0])]; | |||
} while $text =~ /$re/g; | } while $text =~ /$re/g; | |||
$self->{row} = $row; | $self->{row} = $row; | |||
$self->view_start (List::Util::min 0, $row - ($self->nrow >> 1)); | $self->view_start ($row - ($self->nrow >> 1)); | |||
$self->want_refresh; | $self->want_refresh; | |||
return; | return; | |||
} | } | |||
$row = $dir < 0 ? $line->beg - 1 : $line->end + 1; | $row = $dir < 0 ? $line->beg - 1 : $line->end + 1; | |||
} | } | |||
} | } | |||
$self->scr_bell; | $self->scr_bell; | |||
} | } | |||
skipping to change at line 226 | skipping to change at line 226 | |||
} elsif ($keysym == 0xff52) { # up | } elsif ($keysym == 0xff52) { # up | |||
my $line = $self->line ($self->{row}); | my $line = $self->line ($self->{row}); | |||
$self->search (-1, $line->beg - 1) | $self->search (-1, $line->beg - 1) | |||
if $line->beg > $self->top_row; | if $line->beg > $self->top_row; | |||
} elsif ($keysym == 0xff54) { # down | } elsif ($keysym == 0xff54) { # down | |||
my $line = $self->line ($self->{row}); | my $line = $self->line ($self->{row}); | |||
$self->search (+1, $line->end + 1) | $self->search (+1, $line->end + 1) | |||
if $line->end < $self->nrow; | if $line->end < $self->nrow; | |||
} elsif ($keysym == 0xff55) { # prior | } elsif ($keysym == 0xff55) { # prior | |||
my $row = $self->view_start - ($self->nrow - 1); | my $row = $self->view_start - ($self->nrow - 1); | |||
$self->view_start (List::Util::min 0, $row); | $self->view_start ($row); | |||
} elsif ($keysym == 0xff56) { # next | } elsif ($keysym == 0xff56) { # next | |||
my $row = $self->view_start + ($self->nrow - 1); | my $row = $self->view_start + ($self->nrow - 1); | |||
$self->view_start (List::Util::min 0, $row); | $self->view_start ($row); | |||
} elsif ($keysym == 0xff63) { # insert | } elsif ($keysym == 0xff63) { # insert | |||
$self->selection_request (urxvt::CurrentTime, 1); | $self->selection_request (urxvt::CurrentTime, 1); | |||
} elsif ($keysym == 0xff08) { # backspace | } elsif ($keysym == 0xff08) { # backspace | |||
substr $self->{search}, -1, 1, ""; | substr $self->{search}, -1, 1, ""; | |||
$self->search (+1, $self->{row}); | $self->search (+1, $self->{row}); | |||
$self->idle; | $self->idle; | |||
} elsif ($string !~ /[\x00-\x1f\x80-\xaf]/) { | } elsif ($string !~ /[\x00-\x1f\x80-\xaf]/) { | |||
return; # pass to tt_write | return; # pass to tt_write | |||
} | } | |||
End of changes. 5 change blocks. | ||||
5 lines changed or deleted | 5 lines changed or added |