Mercurial > octave-nkf
diff src/pager.cc @ 2100:49cdc5b183bc
[project @ 1996-04-28 11:26:32 by jwe]
author | jwe |
---|---|
date | Sun, 28 Apr 1996 11:29:34 +0000 |
parents | dcf899227c24 |
children | c64b49a4cba3 |
line wrap: on
line diff
--- a/src/pager.cc Sun Apr 28 11:02:23 1996 +0000 +++ b/src/pager.cc Sun Apr 28 11:29:34 1996 +0000 @@ -38,6 +38,7 @@ #include "oct-obj.h" #include "pager.h" #include "sighandlers.h" +#include "unwind-prot.h" #include "user-prefs.h" pid_t octave_pager_pid = -1; @@ -56,6 +57,8 @@ static sig_handler *saved_sigint_handler = 0; +static int really_flush_to_pager = 0; + static void do_sync (const char *msg) { @@ -108,15 +111,20 @@ int octave_pager_buf::sync (void) { - sputc ('\0'); - - char *buf = eback (); + if (really_flush_to_pager + || (user_pref.page_screen_output && user_pref.page_output_immediately) + || ! user_pref.page_screen_output) + { + sputc ('\0'); - do_sync (buf); + char *buf = eback (); + + do_sync (buf); - octave_diary << buf; + octave_diary << buf; - seekoff (0, ios::beg); + seekoff (0, ios::beg); + } return 0; } @@ -185,6 +193,12 @@ void flush_octave_stdout (void) { + begin_unwind_frame ("flush_octave_stdout"); + + unwind_protect_int (really_flush_to_pager); + + really_flush_to_pager = 1; + octave_stdout.flush (); if (external_pager) @@ -200,6 +214,8 @@ saved_sigint_handler = 0; } } + + run_unwind_frame ("flush_octave_stdout"); } static void @@ -344,6 +360,9 @@ DEFVAR (PAGER, default_pager (), 0, sv_pager_binary, "path to pager binary"); + DEFVAR (page_output_immediately, 1.0, 0, page_output_immediately, + "if possible, send output intended for the screen through the pager"); + DEFVAR (page_screen_output, 1.0, 0, page_screen_output, "if possible, send output intended for the screen through the pager"); }