projects
/
spider.git
/ blobdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
|
commitdiff
|
tree
raw
|
inline
| side by side
fix longstanding issues with console EOL handling
[spider.git]
/
perl
/
console.pl
diff --git
a/perl/console.pl
b/perl/console.pl
index cd4a44927e5799c8bf13a2858bb5c11a97972f56..97b6220df84dbdec0663dc3263c368bc19faee32 100755
(executable)
--- a/
perl/console.pl
+++ b/
perl/console.pl
@@
-180,13
+180,18
@@
sub measure
sub show_screen
{
if ($spos == @shistory - 1) {
sub show_screen
{
if ($spos == @shistory - 1) {
-
# if we really are scrolling thru at the end of the history
my $line = $shistory[$spos];
# if we really are scrolling thru at the end of the history
my $line = $shistory[$spos];
- $top->addstr("\n") if $spos > 0;
+ my $y = $spos;
+ if ($spos >= $pagel) {
+ $top->scrl(1);
+ $y = $pagel-1;
+# $top->addstr("\r");
+ }
+ $top->move($y, 0);
+ $top->refresh;
setattr($line);
$top->addstr($line);
setattr($line);
$top->addstr($line);
-# $top->addstr("\n");
$top->attrset(COLOR_PAIR(0)) if $has_colors;
$spos = @shistory;
$top->attrset(COLOR_PAIR(0)) if $has_colors;
$spos = @shistory;
@@
-208,8
+213,7
@@
sub show_screen
for ($i = 0; $i < $pagel && $p < @shistory; $p++) {
my $line = $shistory[$p];
my $lines = measure($line);
for ($i = 0; $i < $pagel && $p < @shistory; $p++) {
my $line = $shistory[$p];
my $lines = measure($line);
- last if $i + $lines > $pagel;
- $top->addstr("\n") if $i;
+ $top->move($i, 0);
setattr($line);
$top->addstr($line);
$top->attrset(COLOR_PAIR(0)) if $has_colors;
setattr($line);
$top->addstr($line);
$top->attrset(COLOR_PAIR(0)) if $has_colors;
@@
-242,7
+246,8
@@
sub addtotop
if ($inbuf =~ s/\x07+$//) {
beep();
}
if ($inbuf =~ s/\x07+$//) {
beep();
}
- if (length $inbuf >= $cols) {
+ $inbuf =~ s/\s+$//s;
+ if (length $inbuf > $cols) {
$Text::Wrap::Columns = $cols;
push @shistory, wrap('',"\t", $inbuf);
} else {
$Text::Wrap::Columns = $cols;
push @shistory, wrap('',"\t", $inbuf);
} else {