fix uninit line in console
[spider.git] / perl / console.pl
index 97c0864c3e89e49b23b4627c4a31724618cfdcd8..a0e4f1087a676825397a46a0e2a0fb8cb19b9ff2 100755 (executable)
@@ -81,6 +81,7 @@ sub do_initscr
        $scr->refresh();
        
        $pagel = LINES()-4;
+       $mycallcolor = COLOR_PAIR(1) unless $mycallcolor;
 }
 
 sub do_resize
@@ -136,9 +137,10 @@ sub measure
 # display the top screen
 sub show_screen
 {
-       if ($spos == @shistory - 1) {
+       if ($spos >= @shistory - 1) {
 
                # if we really are scrolling thru at the end of the history
+               $spos = @shistory - 1 if $spos >= @shistory;
                my $line = $shistory[$spos];
                $top->addstr("\n") if $spos > 0;
                setattr($line);
@@ -174,8 +176,11 @@ sub show_screen
                $spos = @shistory if $spos > @shistory;
        }
     my $shl = @shistory;
-       my $add = "$call-$spos-$shl";
-    $scr->addstr(LINES()-4, 0, '-' x (COLS() - length $add));
+       my $add = "-$spos-$shl";
+    $scr->addstr(LINES()-4, 0, '-' x (COLS() - (length($call) + length($add))));
+       $scr->attrset($mycallcolor) if $has_colors;
+       $scr->addstr("$call");
+       $scr->attrset(COLOR_PAIR(0)) if $has_colors;
     $scr->addstr($add);
        $scr->refresh();
 #      $top->refresh();
@@ -422,7 +427,7 @@ Msg->set_event_handler(\*STDIN, "read" => \&rec_stdin);
 
 for (;;) {
        my $t;
-       Msg->event_loop(1, 0.010);
+       Msg->event_loop(1, 1);
        $top->refresh() if $top->is_wintouched;
        $bot->refresh();
        $t = time;