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.44 by sf-exg, Tue Oct 24 20:12:08 2017 UTC vs.
Revision 1.48 by root, Sat Jul 24 09:48:43 2021 UTC

4 4
5#:META:RESOURCE:%:string:activation hotkey keysym 5#:META:RESOURCE:%:string:activation hotkey keysym
6 6
7=head1 NAME 7=head1 NAME
8 8
9searchable-scrollback - incremental scrollback search (enabled by default) 9searchable-scrollback - incremental scrollback search
10 10
11=head1 DESCRIPTION 11=head1 DESCRIPTION
12 12
13Adds regex search functionality to the scrollback buffer, triggered by 13Adds regex search functionality to the scrollback buffer, triggered by
14the C<searchable-scrollback:start> action (bound to C<M-s> by 14the C<searchable-scrollback:start> action (bound to C<M-s> by
16suspended and a regex is displayed at the bottom of the screen. 16suspended and a regex is displayed at the bottom of the screen.
17 17
18Inputting characters appends them to the regex and continues incremental 18Inputting characters appends them to the regex and continues incremental
19search. In addition, the following bindings are recognized: 19search. In addition, the following bindings are recognized:
20 20
21=over 4 21=over
22 22
23=item C<BackSpace> 23=item C<BackSpace>
24 24
25Remove a character from the regex. 25Remove a character from the regex.
26 26
166 do { 166 do {
167 push @{ $self->{found} }, [$line->coord_of ($-[0]), $line->coord_of ($+[0])]; 167 push @{ $self->{found} }, [$line->coord_of ($-[0]), $line->coord_of ($+[0])];
168 } while $text =~ /$re/g; 168 } while $text =~ /$re/g;
169 169
170 $self->{row} = $row; 170 $self->{row} = $row;
171 $self->view_start (List::Util::min 0, $row - ($self->nrow >> 1)); 171 $self->view_start ($row - ($self->nrow >> 1));
172 $self->want_refresh; 172 $self->want_refresh;
173 return; 173 return;
174 } 174 }
175 175
176 $row = $dir < 0 ? $line->beg - 1 : $line->end + 1; 176 $row = $dir < 0 ? $line->beg - 1 : $line->end + 1;
221 my $line = $self->line ($self->{row}); 221 my $line = $self->line ($self->{row});
222 $self->search (+1, $line->end + 1) 222 $self->search (+1, $line->end + 1)
223 if $line->end < $self->nrow; 223 if $line->end < $self->nrow;
224 } elsif ($keysym == 0xff55) { # prior 224 } elsif ($keysym == 0xff55) { # prior
225 my $row = $self->view_start - ($self->nrow - 1); 225 my $row = $self->view_start - ($self->nrow - 1);
226 $self->view_start (List::Util::min 0, $row); 226 $self->view_start ($row);
227 } elsif ($keysym == 0xff56) { # next 227 } elsif ($keysym == 0xff56) { # next
228 my $row = $self->view_start + ($self->nrow - 1); 228 my $row = $self->view_start + ($self->nrow - 1);
229 $self->view_start (List::Util::min 0, $row); 229 $self->view_start ($row);
230 } elsif ($keysym == 0xff63) { # insert 230 } elsif ($keysym == 0xff63) { # insert
231 $self->selection_request (urxvt::CurrentTime, 1); 231 $self->selection_request (urxvt::CurrentTime, 1);
232 } elsif ($keysym == 0xff08) { # backspace 232 } elsif ($keysym == 0xff08) { # backspace
233 substr $self->{search}, -1, 1, ""; 233 substr $self->{search}, -1, 1, "";
234 $self->search (+1, $self->{row}); 234 $self->search (+1, $self->{row});
242 242
243sub tt_write { 243sub tt_write {
244 my ($self, $data) = @_; 244 my ($self, $data) = @_;
245 245
246 $self->{search} .= $self->locale_decode ($data); 246 $self->{search} .= $self->locale_decode ($data);
247 $self->{search} =~ s/\e\[20[01]~//g;
247 248
248 $self->{search} =~ s/^\(\?i\)// 249 $self->{search} =~ s/^\(\?i\)//
249 if $self->{search} =~ /^\(.*[[:upper:]]/; 250 if $self->{search} =~ /^\(.*[[:upper:]]/;
250 251
251 delete $self->{found}; 252 delete $self->{found};

Diff Legend

Removed lines
+ Added lines
< Changed lines
> Changed lines