--- rxvt-unicode/src/perl/searchable-scrollback 2006/01/12 05:37:34 1.14 +++ rxvt-unicode/src/perl/searchable-scrollback 2006/01/12 11:16:36 1.19 @@ -80,25 +80,25 @@ my $search = $self->special_encode ($self->{search}); no re 'eval'; # just to be sure - my $re = qr/$search/; + if (my $re = eval { qr/$search/ }) { + while ($self->nrow > $row && $row > -$self->nsaved) { + my $line = $self->line ($row) + or last; + + my $text = $line->t; + if ($text =~ /$re/g) { + do { + push @{ $self->{found} }, [$line->coord_of ($-[0]), $line->coord_of ($+[0])]; + } while $text =~ /$re/g; + + $self->{row} = $row; + $self->view_start (List::Util::max 0, -$row + ($self->nrow >> 1)); + $self->want_refresh; + last; + } - while ($self->nrow > $row && $row > -$self->nsaved) { - my $line = $self->line ($row) - or last; - - my $text = $line->t; - if ($text =~ /$re/g) { - do { - push @{ $self->{found} }, [$line->coord_of ($-[0]), $line->coord_of ($+[0])]; - } while $text =~ /$re/g; - - $self->{row} = $row; - $self->view_start (-$row + ($self->nrow >> 1)); - $self->want_refresh; - last; + $row = $dir < 0 ? $line->beg - 1 : $line->end + 1; } - - $row = $dir < 0 ? $line->beg - 1 : $line->end + 1; } $self->scr_bell unless $self->{found}; @@ -107,7 +107,9 @@ sub refresh { my ($self) = @_; - my $xor = urxvt::RS_RVid | urxvt::RS_Uline; + return unless $self->{found}; + + my $xor = urxvt::RS_RVid | urxvt::RS_Blink; for (@{ $self->{found} }) { $self->scr_xor_span (@$_, $xor); $xor = urxvt::RS_RVid; @@ -145,7 +147,7 @@ substr $self->{search}, -1, 1, ""; $self->search; $self->idle; - } elsif ($string =~ /^[^\x00-\x1f\x80-\xaf]+$/) { + } elsif ($string !~ /[\x00-\x1f\x80-\xaf]/) { return; # pass to tt_write }