X-Git-Url: http://dxcluster.org/gitweb/gitweb.cgi?a=blobdiff_plain;f=perl%2Fconsole.pl;h=41eb8016cc38249e2eccb891b38fedc05cede131;hb=8cf374587593eacd30423223278ed63df45babc6;hp=14c945a58987edabecd084078caf58eedca9ed38;hpb=30788e921ae7fb6ca54f043d21f154bfd884dcc6;p=spider.git diff --git a/perl/console.pl b/perl/console.pl index 14c945a5..41eb8016 100755 --- a/perl/console.pl +++ b/perl/console.pl @@ -118,6 +118,15 @@ sub show_screen $top->refresh(); } +# add a line to the end of the top screen +sub addtotop +{ + my $inbuf = shift; + push @shistory, $inbuf; + shift @shistory if @shistory > $maxshist; + show_screen(); +} + # handle incoming messages sub rec_socket { @@ -129,10 +138,7 @@ sub rec_socket my ($sort, $call, $line) = $msg =~ /^(\w)(\S+)\|(.*)$/; if ($sort eq 'D') { - push @shistory, $line; - shift @shistory if @shistory > $maxshist; -# $spos = @shistory if $spos >= @shistory - 1; - show_screen(); + addtotop($line); } elsif ($sort eq 'Z') { # end, disconnect, go, away ..... cease(0); } @@ -157,6 +163,21 @@ sub rec_stdin # 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; @@ -164,6 +185,9 @@ sub rec_stdin $bot->clrtoeol(); $bot->addstr(substr($inbuf, 0, COLS)); } + + # add it to the monitor window + addtotop($inbuf) if $inbuf; # send it to the cluster $inbuf = " " unless $inbuf; @@ -252,11 +276,8 @@ sub rec_stdin $pos++; $lth++; } elsif ($r eq "\014" || $r eq "\022") { - $top->touchwin(); - $bot->touchwin(); - $scr->touchwin(); - $scr->refresh(); - $top->refresh(); +# curscr()->refresh(); + return; } elsif ($r eq "\013") { $inbuf = substr($inbuf, 0, $pos); $lth = length $inbuf;