# HG changeset patch # User Ben Abbott # Date 1260316105 18000 # Node ID b4661b498a7e7177ff4d2f09c66f57cfd7ab92f9 # Parent fea3d4868692ba2256cdaa47285f09275d1706af gnuplot_drawnow.m: Prunec prompt lines from dumb terminal output. diff --git a/scripts/ChangeLog b/scripts/ChangeLog --- a/scripts/ChangeLog +++ b/scripts/ChangeLog @@ -1,5 +1,6 @@ 2009-12-08 Petr Mikulik + * 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. diff --git a/scripts/plot/gnuplot_drawnow.m b/scripts/plot/gnuplot_drawnow.m --- 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 = "";