# 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);
# add a line to the end of the top screen
sub addtotop
{
- my $inbuf = shift;
- push @shistory, $inbuf;
- shift @shistory if @shistory > $maxshist;
+ while (@_) {
+ my $inbuf = shift;
+ push @shistory, $inbuf;
+ shift @shistory if @shistory > $maxshist;
+ }
show_screen();
}