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

Comparing rxvt-unicode/src/perl/searchable-scrollback (file contents):
Revision 1.41 by sf-exg, Tue Oct 14 09:00:52 2014 UTC vs.
Revision 1.44 by sf-exg, Tue Oct 24 20:12:08 2017 UTC

1#! perl 1#! perl
2 2
3# this extension implements scrollback buffer search 3# this extension implements scrollback buffer search
4 4
5#:META:RESOURCE:%:string:activation hotkey keysym 5#:META:RESOURCE:%:string:activation hotkey keysym
6#:META:BINDING:M-s:start
7 6
8=head1 NAME 7=head1 NAME
9 8
10searchable-scrollback - incremental scrollback search (enabled by default) 9searchable-scrollback - incremental scrollback search (enabled by default)
11 10
15the C<searchable-scrollback:start> action (bound to C<M-s> by 14the C<searchable-scrollback:start> action (bound to C<M-s> by
16default). While in search mode, normal terminal input/output is 15default). While in search mode, normal terminal input/output is
17suspended and a regex is displayed at the bottom of the screen. 16suspended and a regex is displayed at the bottom of the screen.
18 17
19Inputting characters appends them to the regex and continues incremental 18Inputting characters appends them to the regex and continues incremental
20search. C<BackSpace> removes a character from the regex, C<Up> and C<Down> 19search. In addition, the following bindings are recognized:
21search upwards/downwards in the scrollback buffer, C<End> jumps to the 20
22bottom. C<Escape> leaves search mode and returns to the point where search 21=over 4
23was started, while C<Enter> or C<Return> stay at the current position and 22
24additionally stores the first match in the current line into the primary 23=item C<BackSpace>
25selection if the C<Shift> modifier is active. 24
25Remove a character from the regex.
26
27=item C<Insert>
28
29Append the value of the PRIMARY selection to the regex.
30
31=item C<Up>
32
33Search for a match upwards.
34
35=item C<Down>
36
37Search for a match downwards.
38
39=item C<Prior>
40
41Scroll up.
42
43=item C<Next>
44
45Scroll down.
46
47=item C<End>
48
49Scroll to the bottom.
50
51=item C<Escape>
52
53Leave the mode and return to the point where search was started.
54
55=item C<Enter> or C<Return>
56
57Leave the mode maintaining the current position in the scrollback.
58Additionally, if the C<Shift> modifier is active, store the first
59match in the current line into the primary selection.
60
61=back
26 62
27The regex defaults to "(?i)", resulting in a case-insensitive search. To 63The regex defaults to "(?i)", resulting in a case-insensitive search. To
28get a case-sensitive search you can delete this prefix using C<BackSpace> 64get a case-sensitive search you can delete this prefix using C<BackSpace>
29or simply use an uppercase character which removes the "(?i)" prefix. 65or simply use an uppercase character which removes the "(?i)" prefix.
30 66
36 my ($self) = @_; 72 my ($self) = @_;
37 73
38 # only for backwards compatibility 74 # only for backwards compatibility
39 my $hotkey = $self->{argv}[0] 75 my $hotkey = $self->{argv}[0]
40 || $self->x_resource ("%") 76 || $self->x_resource ("%")
41 || return; 77 || "M-s";
42 78
43 $self->bind_action ($hotkey, "searchable-scrollback:start") # ugh 79 $self->bind_action ($hotkey, "%:start")
44 or warn "unable to register '$hotkey' as scrollback search start hotkey\n"; 80 or warn "unable to register '$hotkey' as scrollback search start hotkey\n";
45 81
46 () 82 ()
47} 83}
48 84
183 if $line->beg > $self->top_row; 219 if $line->beg > $self->top_row;
184 } elsif ($keysym == 0xff54) { # down 220 } elsif ($keysym == 0xff54) { # down
185 my $line = $self->line ($self->{row}); 221 my $line = $self->line ($self->{row});
186 $self->search (+1, $line->end + 1) 222 $self->search (+1, $line->end + 1)
187 if $line->end < $self->nrow; 223 if $line->end < $self->nrow;
224 } elsif ($keysym == 0xff55) { # prior
225 my $row = $self->view_start - ($self->nrow - 1);
226 $self->view_start (List::Util::min 0, $row);
227 } elsif ($keysym == 0xff56) { # next
228 my $row = $self->view_start + ($self->nrow - 1);
229 $self->view_start (List::Util::min 0, $row);
230 } elsif ($keysym == 0xff63) { # insert
231 $self->selection_request (urxvt::CurrentTime, 1);
188 } elsif ($keysym == 0xff08) { # backspace 232 } elsif ($keysym == 0xff08) { # backspace
189 substr $self->{search}, -1, 1, ""; 233 substr $self->{search}, -1, 1, "";
190 $self->search (+1, $self->{row}); 234 $self->search (+1, $self->{row});
191 $self->idle; 235 $self->idle;
192 } elsif ($string !~ /[\x00-\x1f\x80-\xaf]/) { 236 } elsif ($string !~ /[\x00-\x1f\x80-\xaf]/) {

Diff Legend

Removed lines
+ Added lines
< Changed lines
> Changed lines