changeset 16537:106a38d7b396

optionall disable redisplay in command editor clear screen function * oct-rl-edit.c (octave_rl_clear_screen): Likewise. If skip_redisplay is true, override rl_redisplay_function. Otherwise, just call rl_clear_screen. * cmd-edit.h, cmd-edit.cc (command_editor::clear_screen, command_editor::do_clear_screen, gnu_readline::do_clear_screen): New arg, skip_redisplay. * sysdep.cc (Fclc): Pass true to command_editor::clear_screen.
author John W. Eaton <jwe@octave.org>
date Thu, 18 Apr 2013 02:02:59 -0400
parents 7f634697a7b4
children 8e180eac78d0
files libinterp/interpfcn/sysdep.cc liboctave/util/cmd-edit.cc liboctave/util/cmd-edit.h liboctave/util/oct-rl-edit.c liboctave/util/oct-rl-edit.h
diffstat 5 files changed, 22 insertions(+), 14 deletions(-) [+]
line wrap: on
line diff
--- a/libinterp/interpfcn/sysdep.cc	Wed Apr 17 17:59:04 2013 -0400
+++ b/libinterp/interpfcn/sysdep.cc	Thu Apr 18 02:02:59 2013 -0400
@@ -523,7 +523,9 @@
 Clear the terminal screen and move the cursor to the upper left corner.\n\
 @end deftypefn")
 {
-  command_editor::clear_screen ();
+  bool skip_redisplay = true;
+
+  command_editor::clear_screen (skip_redisplay);
 
   return octave_value_list ();
 }
--- a/liboctave/util/cmd-edit.cc	Wed Apr 17 17:59:04 2013 -0400
+++ b/liboctave/util/cmd-edit.cc	Thu Apr 18 02:02:59 2013 -0400
@@ -90,7 +90,7 @@
 
   int do_terminal_cols (void);
 
-  void do_clear_screen (void);
+  void do_clear_screen (bool skip_redisplay);
 
   void do_resize_terminal (void);
 
@@ -315,9 +315,9 @@
 }
 
 void
-gnu_readline::do_clear_screen (void)
+gnu_readline::do_clear_screen (bool skip_redisplay)
 {
-  ::octave_rl_clear_screen ();
+  ::octave_rl_clear_screen (skip_redisplay);
 }
 
 void
@@ -976,10 +976,10 @@
 }
 
 void
-command_editor::clear_screen (void)
+command_editor::clear_screen (bool skip_redisplay)
 {
   if (instance_ok ())
-    instance->do_clear_screen ();
+    instance->do_clear_screen (skip_redisplay);
 }
 
 void
--- a/liboctave/util/cmd-edit.h	Wed Apr 17 17:59:04 2013 -0400
+++ b/liboctave/util/cmd-edit.h	Thu Apr 18 02:02:59 2013 -0400
@@ -75,7 +75,7 @@
 
   static int terminal_cols (void);
 
-  static void clear_screen (void);
+  static void clear_screen (bool skip_redisplay = false);
 
   static void resize_terminal (void);
 
@@ -217,7 +217,7 @@
 
   virtual int do_terminal_cols (void) { return 80; }
 
-  virtual void do_clear_screen (void) { }
+  virtual void do_clear_screen (bool) { }
 
   virtual void do_resize_terminal (void) { }
 
--- a/liboctave/util/oct-rl-edit.c	Wed Apr 17 17:59:04 2013 -0400
+++ b/liboctave/util/oct-rl-edit.c	Thu Apr 18 02:02:59 2013 -0400
@@ -91,17 +91,23 @@
 }
 
 void
-octave_rl_clear_screen (void)
+octave_rl_clear_screen (int skip_redisplay)
 {
   int ignore1 = 0;
   int ignore2 = 0;
 
-  rl_voidfunc_t *saved_redisplay_function = rl_redisplay_function;
-  rl_redisplay_function = flush_stdout;
+  if (skip_redisplay)
+    {
+      rl_voidfunc_t *saved_redisplay_function = rl_redisplay_function;
+
+      rl_redisplay_function = flush_stdout;
 
-  rl_clear_screen (ignore1, ignore2);
+      rl_clear_screen (ignore1, ignore2);
 
-  rl_redisplay_function = saved_redisplay_function;
+      rl_redisplay_function = saved_redisplay_function;
+    }
+  else
+    rl_clear_screen (ignore1, ignore2);
 }
 
 void
--- a/liboctave/util/oct-rl-edit.h	Wed Apr 17 17:59:04 2013 -0400
+++ b/liboctave/util/oct-rl-edit.h	Thu Apr 18 02:02:59 2013 -0400
@@ -56,7 +56,7 @@
 
 extern void octave_rl_init (void);
 
-extern void octave_rl_clear_screen (void);
+extern void octave_rl_clear_screen (int skip_redisplay);
 
 extern void octave_rl_resize_terminal (void);