home
***
CD-ROM
|
disk
|
FTP
|
other
***
search
/
PC World 2005 December (Special)
/
PCWorld_2005-12_Special_cd.bin
/
Bezpecnost
/
lsti
/
lsti.exe
/
framework-2.5.exe
/
vi_N.al
< prev
next >
Wrap
Text File
|
2005-04-27
|
1KB
|
47 lines
# NOTE: Derived from lib/Term/ReadLine/Zoid/ViCommand.pm.
# Changes made here will be lost when autosplit is run again.
# See AutoSplit.pm.
package Term::ReadLine::Zoid::ViCommand;
#line 800 "lib/Term/ReadLine/Zoid/ViCommand.pm (autosplit into blib/lib/auto/Term/ReadLine/Zoid/ViCommand/vi_N.al)"
sub vi_N { # last_search = [ dir, string, hist_p ]
my ($self, $key, undef, $dir) = @_; # dir == direction
return $self->bell unless $$self{last_search};
$dir ||= $$self{last_search}[0];
$dir =~ tr/bf/fb/ if $key eq 'N'; # reverse dir
my $reg = eval { qr/$$self{last_search}[1]/ };
return $self->bell if $@;
my ($succes, $hist_p) = (0, $$self{last_search}[2]);
#print STDERR "lookign from $hist_p for: $reg\n";
if ($dir eq 'b') {
while ($hist_p < $#{$$self{history}}) {
$hist_p++;
next unless $$self{history}[$hist_p] =~ $reg;
$succes++;
last;
}
}
else { # $dir eq 'f'
$hist_p = scalar @{$$self{history}} if $hist_p < 0;
while ($hist_p > 0) {
$hist_p--;
next unless $$self{history}[$hist_p] =~ $reg;
$succes++;
last;
}
}
#print STDERR "succes: $succes at: $hist_p\n";
if ($succes) {
$self->set_history($hist_p);
$$self{last_search}[2] = $hist_p;
return 1;
}
else { return $self->bell }
}
# end of Term::ReadLine::Zoid::ViCommand::vi_N
1;