projects
/
spider.git
/ blobdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
|
commitdiff
|
tree
raw
|
inline
| side by side
detail changes in console
[spider.git]
/
perl
/
console.pl
diff --git
a/perl/console.pl
b/perl/console.pl
index 29817564533c95cd37b243435c683c13c06409ab..0cb15bd0fbc0171446f40fde6151ee100621f8d7 100755
(executable)
--- a/
perl/console.pl
+++ b/
perl/console.pl
@@
-118,6
+118,15
@@
sub show_screen
$top->refresh();
}
$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
{
# handle incoming messages
sub rec_socket
{
@@
-129,10
+138,7
@@
sub rec_socket
my ($sort, $call, $line) = $msg =~ /^(\w)(\S+)\|(.*)$/;
if ($sort eq 'D') {
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);
}
} elsif ($sort eq 'Z') { # end, disconnect, go, away .....
cease(0);
}
@@
-164,6
+170,9
@@
sub rec_stdin
$bot->clrtoeol();
$bot->addstr(substr($inbuf, 0, COLS));
}
$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;
# send it to the cluster
$inbuf = " " unless $inbuf;
@@
-186,7
+195,7
@@
sub rec_stdin
} else {
beep();
}
} else {
beep();
}
- } elsif ($r eq KEY_PPAGE || $r eq "\0
26
") {
+ } elsif ($r eq KEY_PPAGE || $r eq "\0
32
") {
if ($spos > 0) {
$spos -= $pages;
$spos = 0 if $spos < 0;
if ($spos > 0) {
$spos -= $pages;
$spos = 0 if $spos < 0;
@@
-194,7
+203,7
@@
sub rec_stdin
} else {
beep();
}
} else {
beep();
}
- } elsif ($r eq KEY_NPAGE || $r eq "\0
32
") {
+ } elsif ($r eq KEY_NPAGE || $r eq "\0
26
") {
if ($spos < @shistory - 1) {
$spos += $pages;
$spos = @shistory if $spos > @shistory;
if ($spos < @shistory - 1) {
$spos += $pages;
$spos = @shistory if $spos > @shistory;
@@
-216,6
+225,8
@@
sub rec_stdin
}
} elsif ($r eq KEY_HOME || $r eq "\001") {
$pos = 0;
}
} elsif ($r eq KEY_HOME || $r eq "\001") {
$pos = 0;
+ } elsif ($r eq KEY_END || $r eq "\005") {
+ $pos = $lth;
} elsif ($r eq KEY_BACKSPACE || $r eq "\010") {
if ($pos > 0) {
my $a = substr($inbuf, 0, $pos-1);
} elsif ($r eq KEY_BACKSPACE || $r eq "\010") {
if ($pos > 0) {
my $a = substr($inbuf, 0, $pos-1);
@@
-250,11
+261,11
@@
sub rec_stdin
$pos++;
$lth++;
} elsif ($r eq "\014" || $r eq "\022") {
$pos++;
$lth++;
} elsif ($r eq "\014" || $r eq "\022") {
-
$scr->touchwin
();
-
$scr->refresh()
;
+
# curscr()->refresh
();
+
return
;
} elsif ($r eq "\013") {
} elsif ($r eq "\013") {
- $inbuf =
""
;
- $
pos = $lth = 0
;
+ $inbuf =
substr($inbuf, 0, $pos)
;
+ $
lth = length $inbuf
;
} else {
beep();
}
} else {
beep();
}