Mercurial > hg > octave-lojdl
changeset 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 | fea3d4868692 |
children | 55061c7c8d6e |
files | scripts/ChangeLog scripts/plot/gnuplot_drawnow.m |
diffstat | 2 files changed, 12 insertions(+), 3 deletions(-) [+] |
line wrap: on
line diff
--- a/scripts/ChangeLog +++ b/scripts/ChangeLog @@ -1,5 +1,6 @@ 2009-12-08 Petr Mikulik <mikulik@physics.muni.cz> + * plot/gnuplot_drawnow.m: Prune prompt lines from dumb terminal output. * plot/__go_draw_figure__.m: Add missing 'unset multiplot' to restore hotkey and mouse functionality for 2D plots.
--- 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 = "";