lilalo

diff l3-agent @ 157:137cf5a580be

bsd fix
author Igor Chubin <igor@chub.in>
date Mon Nov 28 13:26:46 2011 +0200 (2011-11-28)
parents 58c869722fd0
children 8ee5e59f1bd3
line diff
     1.1 --- a/l3-agent	Sun Jun 29 15:09:04 2008 +0300
     1.2 +++ b/l3-agent	Mon Nov 28 13:26:46 2011 +0200
     1.3 @@ -344,6 +344,7 @@
     1.4          my $tty = $1;
     1.5          my %cl;
     1.6          my $last_output_length=0;
     1.7 +	my $saved_output;
     1.8          while (<FILE>) {
     1.9              $commandlines_processed++;
    1.10  
    1.11 @@ -555,6 +556,7 @@
    1.12  
    1.13                  # Output
    1.14                  if (!$last_cl{"suppress_output"} || $last_cl{"err"}) {
    1.15 +                    $last_cl{"output"}=$saved_output;
    1.16                      for (my $i=0; $i<$Config{"terminal_height"}; $i++) {
    1.17                          my $line= $vt{$local_session_id}->row_plaintext($i);
    1.18                          next if !defined ($line) ; #|| $line =~ /^\s*$/;
    1.19 @@ -568,6 +570,7 @@
    1.20                  }
    1.21  
    1.22                  $vt{$local_session_id}->reset();
    1.23 +		$saved_output="";
    1.24  
    1.25  
    1.26                  # Changing encoding 
    1.27 @@ -588,6 +591,20 @@
    1.28                  next;
    1.29              }
    1.30  
    1.31 +            if (($commandlines_processed%100) == 0) {
    1.32 +# Каждые сто строк обнуляем терминал и переносим вывод из него в кэш
    1.33 +                # Output
    1.34 +	        for (my $i=0; $i<$Config{"terminal_height"}; $i++) {
    1.35 +	   	    my $line= $vt{$local_session_id}->row_plaintext($i);
    1.36 +		    next if !defined ($line) ; #|| $line =~ /^\s*$/;
    1.37 +		    $line =~ s/\s*$//;
    1.38 +		    $line .= "\n" unless $line =~ /^\s*$/;
    1.39 +		    $saved_output .= $line;
    1.40 +	        }
    1.41 +                $vt{$local_session_id}->reset();
    1.42 +                $last_output_length=0;
    1.43 +	    }
    1.44 +
    1.45  # Иначе, это строка вывода
    1.46  
    1.47              $last_output_length+=length($_);