Mercurial > hg > octave-nkf
diff scripts/plot/gnuplot_drawnow.m @ 9945:b4661b498a7e
gnuplot_drawnow.m: Prunec prompt lines from dumb terminal output.
author | Ben Abbott <bpabbott@mac.com> |
---|---|
date | Tue, 08 Dec 2009 18:48:25 -0500 |
parents | ccad98db781b |
children | 1ca904d74f78 |
line wrap: on
line diff
--- a/scripts/plot/gnuplot_drawnow.m +++ b/scripts/plot/gnuplot_drawnow.m @@ -106,8 +106,14 @@ endwhile ## reprint the plot on screen [a, count] = fscanf (fid, '%c', Inf); - puts (a); fclose (fid); + if (count>0) + if (a(1)==12) + ## avoid ^L at the beginning + a = a(2:end); + end + puts (a); + end unlink (dumb_tmp_file); endif else @@ -264,8 +270,10 @@ elseif (strncmpi (term, "dumb", 3)) new_stream = 1; if (~isempty (getenv ("COLUMNS")) && ~isempty (getenv ("LINES"))) - ## Let dumb use full text screen size. - size_str = ["size ", getenv("COLUMNS"), " ", getenv("LINES")]; + ## Let dumb use full text screen size (minus prompt lines). + n = sprintf ("%i", -2 - length (find (sprintf ("%s", PS1) == "\n"))); + ## n = the number of times \n appears in PS1 + size_str = ["size ", getenv("COLUMNS"), ",", getenv("LINES"), n]; else ## Use the gnuplot default. size_str = "";