… | |
… | |
5 | sub on_init { |
5 | sub on_init { |
6 | my ($self) = @_; |
6 | my ($self) = @_; |
7 | |
7 | |
8 | my $hotkey = $self->{argv}[0] || "M-s"; |
8 | my $hotkey = $self->{argv}[0] || "M-s"; |
9 | |
9 | |
10 | $self->parse_keysym ($hotkey, "perl:searchable-scrollback:enter") |
10 | $self->parse_keysym ($hotkey, "perl:searchable-scrollback:start") |
11 | or warn "unable to register '$hotkey' as scrollback search enter hotkey\n"; |
11 | or warn "unable to register '$hotkey' as scrollback search start hotkey\n"; |
12 | |
12 | |
13 | () |
13 | () |
14 | } |
14 | } |
15 | |
15 | |
16 | sub on_keyboard_command { |
16 | sub on_keyboard_command { |
17 | my ($self, $cmd) = @_; |
17 | my ($self, $cmd) = @_; |
18 | |
18 | |
19 | if ($cmd eq "searchable-scrollback:enter") { |
19 | if ($cmd eq "searchable-scrollback:start") { |
20 | $self->enter; |
20 | $self->enter; |
21 | } |
21 | } |
22 | |
22 | |
23 | () |
23 | () |
24 | } |
24 | } |
… | |
… | |
59 | } |
59 | } |
60 | |
60 | |
61 | sub idle { |
61 | sub idle { |
62 | my ($self) = @_; |
62 | my ($self) = @_; |
63 | |
63 | |
64 | $self->msg ("scrollback search, escape=exit, enter=accept, /=start search, n=next, p=previous"); |
64 | $self->msg ("scrollback search, escape=exit, enter=accept, /=start search, n=next, p=previous, G=bottom"); |
65 | |
65 | |
66 | delete $self->{in_search}; |
66 | delete $self->{in_search}; |
67 | } |
67 | } |
68 | |
68 | |
69 | sub search { |
69 | sub search { |
… | |
… | |
92 | |
92 | |
93 | $row = $line->beg - 1; |
93 | $row = $line->beg - 1; |
94 | } |
94 | } |
95 | |
95 | |
96 | $self->msg ("enter/type/backspace: /$self->{search}_" |
96 | $self->msg ("enter/type/backspace: /$self->{search}_" |
97 | . ($self->{found} ? " (not found)" : "")); |
97 | . ($self->{found} ? "" : " (not found)")); |
98 | $self->scr_bell unless $self->{found}; |
98 | $self->scr_bell unless $self->{found}; |
99 | } |
99 | } |
100 | |
100 | |
101 | sub refresh { |
101 | sub refresh { |
102 | my ($self) = @_; |
102 | my ($self) = @_; |
… | |
… | |
139 | } elsif ($keysym == 0xff54) { |
139 | } elsif ($keysym == 0xff54) { |
140 | $self->view_start ($self->view_start - 1); |
140 | $self->view_start ($self->view_start - 1); |
141 | } elsif ($string eq "/") { |
141 | } elsif ($string eq "/") { |
142 | $self->{in_search} = $self->view_start; |
142 | $self->{in_search} = $self->view_start; |
143 | $self->search; |
143 | $self->search; |
|
|
144 | } elsif ($string eq "G") { |
|
|
145 | $self->view_start (0); |
144 | } elsif ($string eq "n") { |
146 | } elsif ($string eq "n") { |
145 | $self->search; |
147 | $self->search; |
146 | } elsif ($string eq "p") { |
148 | } elsif ($string eq "p") { |
|
|
149 | # TODO |
147 | } elsif ($string ne "") { |
150 | } elsif ($string ne "") { |
148 | $self->scr_bell; |
151 | $self->scr_bell; |
149 | } |
152 | } |
150 | } |
153 | } |
151 | |
154 | |