--- rxvt-unicode/src/perl/searchable-scrollback 2010/04/01 18:36:23 1.25 +++ rxvt-unicode/src/perl/searchable-scrollback 2014/05/17 17:12:29 1.34 @@ -2,23 +2,54 @@ # this extension implements scrollback buffer search +#:META:RESOURCE:%:string:activation hotkey keysym +#:META:BINDING:M-s:start + +=head1 NAME + +searchable-scrollback - incremental scrollback search (enabled by default) + +=head1 DESCRIPTION + +Adds regex search functionality to the scrollback buffer, triggered +by a hotkey (default: C). While in search mode, normal terminal +input/output is suspended and a regex is displayed at the bottom of the +screen. + +Inputting characters appends them to the regex and continues incremental +search. C removes a character from the regex, C and C +search upwards/downwards in the scrollback buffer, C jumps to the +bottom. C leaves search mode and returns to the point where search +was started, while C or C stay at the current position and +additionally stores the first match in the current line into the primary +selection if the C modifier is active. + +The regex defaults to "(?i)", resulting in a case-insensitive search. To +get a case-sensitive search you can delete this prefix using C +or simply use an uppercase character which removes the "(?i)" prefix. + +See L for more info about perl regular expression syntax. + +=cut + sub on_init { my ($self) = @_; + # only for backwards compatibility my $hotkey = $self->{argv}[0] - || $self->x_resource ("searchable-scrollback") - || "M-s"; + || $self->x_resource ("%") + || return; - $self->parse_keysym ($hotkey, "perl:searchable-scrollback:start") + $self->bind_action ($hotkey, "searchable-scrollback:start") # ugh or warn "unable to register '$hotkey' as scrollback search start hotkey\n"; () } -sub on_user_command { - my ($self, $cmd) = @_; +sub on_action { + my ($self, $action) = @_; - $cmd eq "searchable-scrollback:start" + $action eq "start" and $self->enter; () @@ -162,7 +193,7 @@ $self->{search} =~ s/^\(\?i\)// if $self->{search} =~ /^\(.*[[:upper:]]/; - + $self->search (-1); $self->idle;