diff src/pager.cc @ 3756:41404c6f4e69

[project @ 2000-12-15 03:14:44 by jwe]
author jwe
date Fri, 15 Dec 2000 03:14:45 +0000
parents aa31644d9779
children 13905c3a24af
line wrap: on
line diff
--- a/src/pager.cc	Thu Dec 14 23:02:49 2000 +0000
+++ b/src/pager.cc	Fri Dec 15 03:14:45 2000 +0000
@@ -241,7 +241,7 @@
 
 	  seekoff (0, std::ios::beg);
 
-	  octave_diary.write (buf, len);
+	  flush_current_contents_to_diary ();
 	}
     }
 
@@ -251,11 +251,19 @@
 void
 octave_pager_buf::flush_current_contents_to_diary (void)
 {
-  char *buf = eback ();
+  char *buf = eback () + diary_skip;
 
-  int len = pptr () - buf;
+  size_t len = pptr () - buf;
 
   octave_diary.write (buf, len);
+
+  diary_skip = 0;  
+}
+
+void
+octave_pager_buf::set_diary_skip (void)
+{
+  diary_skip = pptr () - eback ();
 }
 
 int
@@ -305,6 +313,13 @@
     pb->flush_current_contents_to_diary ();
 }
 
+void
+octave_pager_stream::set_diary_skip (void)
+{
+  if (pb)
+    pb->set_diary_skip ();
+}
+
 octave_diary_stream *octave_diary_stream::instance = 0;
 
 octave_diary_stream::octave_diary_stream (void) : std::ostream (), db (0)
@@ -379,6 +394,11 @@
 {
   close_diary_file ();
 
+  // If there is pending output in the pager buf, it should not go
+  // into the diary file.
+ 
+  octave_stdout.set_diary_skip ();
+
   external_diary_file.open (diary_file.c_str (), std::ios::app);
 
   if (! external_diary_file)