fix it so that you can type in '0' again
[spider.git] / perl / console.pl
index df524beb140241de71b4e19265fc88d25281fb33..eae1c0ff4451a477af22765c3d36cfd3f00bc538 100755 (executable)
@@ -85,11 +85,13 @@ sub do_initscr
        $top = $scr->subwin($lines-4, $cols, 0, 0);
        $top->intrflush(0);
        $top->scrollok(1);
+       $top->idlok(1);
        $top->meta(1);
 #      $scr->addstr($lines-4, 0, '-' x $cols);
        $bot = $scr->subwin(3, $cols, $lines-3, 0);
        $bot->intrflush(0);
        $bot->scrollok(1);
+       $top->idlok(1);
        $bot->keypad(1);
        $bot->move(1,0);
        $bot->meta(1);
@@ -106,7 +108,8 @@ sub do_resize
        initscr();
        raw();
        noecho();
-       $lines = LINES;
+       nonl();
+       $lines = LINES;
        $cols = COLS;
        $has_colors = has_colors();
        do_initscr();
@@ -168,6 +171,7 @@ sub show_screen
                $top->addstr("\n") if $spos > 0;
                setattr($line);
                $top->addstr($line);
+#              $top->addstr("\n");
                $top->attrset(COLOR_PAIR(0)) if $has_colors;
                $spos = @shistory;
                
@@ -237,7 +241,7 @@ sub rec_socket
                my ($sort, $call, $line) = $msg =~ /^(\w)([^\|]+)\|(.*)$/;
                
                if ($sort && $sort eq 'D') {
-                       $line = " " unless $line;
+                       $line = " " unless length($line);
                        addtotop($line);
                } elsif ($sort && $sort eq 'Z') { # end, disconnect, go, away .....
                        cease(0);
@@ -265,11 +269,12 @@ sub rec_stdin
        #  print "sys: $r ($prbuf)\n";
        if (defined $r) {
 
+               $r = '0' if !$r;
                
                if ($r eq KEY_ENTER || $r eq "\n" || $r eq "\r") {
                        
                        # save the lines
-                       $inbuf = " " unless $inbuf;
+                       $inbuf = " " unless length($inbuf);
 
                        # check for a pling and do a search back for a command
                        if ($inbuf =~ /^!/o) {
@@ -388,7 +393,7 @@ sub rec_stdin
                } elsif ($r eq KEY_RESIZE || $r eq "\0632") {
                        do_resize();
                        return;
-               } elsif (is_pctext($r)) {
+               } elsif (defined is_pctext($r)) {
                        # move the top screen back to the bottom if you type something
                        if ($spos < @shistory) {
                                $spos = @shistory;