1 | #! perl |
1 | #! perl |
2 | |
2 | |
3 | # this extension implements scrollback buffer search |
3 | # this extension implements scrollback buffer search |
4 | |
4 | |
5 | #:META:X_RESOURCE:%:string:activation hotkey keysym |
5 | #:META:RESOURCE:%:string:activation hotkey keysym |
|
|
6 | #:META:BINDING:M-s:start |
6 | |
7 | |
7 | =head1 NAME |
8 | =head1 NAME |
8 | |
9 | |
9 | searchable-scrollback<hotkey> - incremental scrollback search (enabled by default) |
10 | searchable-scrollback<hotkey> - incremental scrollback search (enabled by default) |
10 | |
11 | |
11 | =head1 DESCRIPTION |
12 | =head1 DESCRIPTION |
12 | |
13 | |
13 | Adds regex search functionality to the scrollback buffer, triggered |
14 | Adds regex search functionality to the scrollback buffer, triggered |
14 | by a hotkey (default: C<M-s>). While in search mode, normal terminal |
15 | by a hotkey (default: C<M-s>). While in search mode, normal terminal |
… | |
… | |
32 | =cut |
33 | =cut |
33 | |
34 | |
34 | sub on_init { |
35 | sub on_init { |
35 | my ($self) = @_; |
36 | my ($self) = @_; |
36 | |
37 | |
|
|
38 | # only for backwards compatibility |
37 | my $hotkey = $self->{argv}[0] |
39 | my $hotkey = $self->{argv}[0] |
38 | || $self->x_resource ("%") |
40 | || $self->x_resource ("%") |
39 | || "M-s"; |
41 | || "M-s"; |
40 | |
42 | |
41 | $self->parse_keysym ($hotkey, "perl:searchable-scrollback:start") |
43 | $self->bind_action ($hotkey, "searchable-scrollback:start") # ugh |
42 | or warn "unable to register '$hotkey' as scrollback search start hotkey\n"; |
44 | or warn "unable to register '$hotkey' as scrollback search start hotkey\n"; |
43 | |
45 | |
44 | () |
46 | () |
45 | } |
47 | } |
46 | |
48 | |
47 | sub on_user_command { |
49 | sub on_action { |
48 | my ($self, $cmd) = @_; |
50 | my ($self, $action) = @_; |
49 | |
51 | |
50 | $cmd eq "searchable-scrollback:start" |
52 | $action eq "start" |
51 | and $self->enter; |
53 | and $self->enter; |
52 | |
54 | |
53 | () |
55 | () |
54 | } |
56 | } |
55 | |
57 | |