X-Git-Url: http://dxcluster.org/gitweb/gitweb.cgi?a=blobdiff_plain;f=perl%2Fconsole.pl;h=fd033d90d66cb704d9efcb939344bbeac5522ab0;hb=b672afe940f843351af2bc4a87b4c4239f3a5140;hp=4dba480b03ea56b19d60b8d68a89b382a9d6cabe;hpb=c71a54705682b0a66d6729af5f043dc2c2df276a;p=spider.git diff --git a/perl/console.pl b/perl/console.pl index 4dba480b..fd033d90 100755 --- a/perl/console.pl +++ b/perl/console.pl @@ -191,7 +191,7 @@ sub show_screen my $lines = measure($line); last if $i + $lines > $pagel; setattr($line); - $top->addstr($i, 0, $line); + $top->addstr($i, 0, "$line\n"); $top->attrset(COLOR_PAIR(0)) if $has_colors; $i += $lines; } @@ -236,6 +236,7 @@ sub rec_socket my ($sort, $call, $line) = $msg =~ /^(\w)([^\|]+)\|(.*)$/; if ($sort && $sort eq 'D') { + $line = " " unless $line; addtotop($line); } elsif ($sort && $sort eq 'Z') { # end, disconnect, go, away ..... cease(0); @@ -267,39 +268,38 @@ sub rec_stdin 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; + $inbuf = " " unless $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; } } - push @khistory, $inbuf if $inbuf; - shift @khistory if @khistory > $maxkhist; - $khistpos = @khistory; - $bot->move(0,0); - $bot->clrtoeol(); - $bot->addstr(substr($inbuf, 0, $cols)); + if ($i < 0) { + beep(); + return; + } } + push @khistory, $inbuf if $inbuf; + shift @khistory if @khistory > $maxkhist; + $khistpos = @khistory; + $bot->move(0,0); + $bot->clrtoeol(); + $bot->addstr(substr($inbuf, 0, $cols)); # add it to the monitor window unless ($spos == @shistory) { $spos = @shistory; show_screen(); }; - addtotop($inbuf) if $inbuf; + addtotop($inbuf); # send it to the cluster - $inbuf = " " unless $inbuf; $conn->send_later("I$call|$inbuf"); $inbuf = ""; $pos = $lth = 0;