Mercurial > octave-nkf
diff src/pager.cc @ 3477:4b79cb009dd4
[project @ 2000-01-26 00:55:22 by jwe]
author | jwe |
---|---|
date | Wed, 26 Jan 2000 00:55:23 +0000 |
parents | 36405da8e173 |
children | d14c483b3c12 |
line wrap: on
line diff
--- a/src/pager.cc Wed Jan 26 00:05:45 2000 +0000 +++ b/src/pager.cc Wed Jan 26 00:55:23 2000 +0000 @@ -250,6 +250,16 @@ return 0; } +void +octave_pager_buf::flush_current_contents_to_diary (void) +{ + char *buf = eback (); + + int len = pptr () - buf; + + octave_diary.write (buf, len); +} + int octave_diary_buf::sync (void) { @@ -290,6 +300,13 @@ return *instance; } +void +octave_pager_stream::flush_current_contents_to_diary (void) +{ + if (pb) + pb->flush_current_contents_to_diary (); +} + octave_diary_stream *octave_diary_stream::instance = 0; octave_diary_stream::octave_diary_stream (void) : ostream (), db (0) @@ -339,6 +356,19 @@ static void close_diary_file (void) { + // Try to flush the current buffer to the diary now, so that things + // like + // + // function foo () + // diary on; + // ... + // diary off; + // endfunction + // + // will do the right thing. + + octave_stdout.flush_current_contents_to_diary (); + if (external_diary_file.is_open ()) { octave_diary.flush ();