# $prbuf =~ s/\n/\\n/;
# print "sys: $r ($prbuf)\n";
if (defined $r) {
+
if ($r eq KEY_ENTER || $r eq "\n" || $r eq "\r") {
# save the lines
if ($inbuf) {
+ # check for a pling and do a search back for a command
+ if ($inbuf =~ /^!/o) {
+ my $i;
+ $inbuf =~ s/^!//o;
+ for ($i = $#khistory; $i >= 0; $i--) {
+ if ($khistory[$i] =~ /^$inbuf/) {
+ $inbuf = $khistory[$i];
+ last;
+ }
+ }
+ if ($i < 0) {
+ beep();
+ return;
+ }
+ }
push @khistory, $inbuf if $inbuf;
shift @khistory if @khistory > $maxkhist;
$khistpos = @khistory;
beep();
}
} elsif ($r ge ' ' && $r le '~') {
+ # move the top screen back to the bottom if you type something
+ if ($spos < @shistory - 1) {
+ $spos = @shistory;
+ show_screen();
+ }
+
+ # insert the character into the keyboard buffer
if ($pos < $lth) {
my $a = substr($inbuf, 0, $pos);
my $b = substr($inbuf, $pos);