changeset 16535:6ebd1e1a6b73

backout changeest 0696dcc92fc8; we'll do this in readline
author John W. Eaton <jwe@octave.org>
date Wed, 17 Apr 2013 17:57:58 -0400
parents 1dce0510b1e8
children 7f634697a7b4
files liboctave/system/lo-sysdep.cc liboctave/system/lo-sysdep.h liboctave/util/cmd-edit.cc liboctave/util/oct-rl-edit.c
diffstat 4 files changed, 11 insertions(+), 41 deletions(-) [+]
line wrap: on
line diff
--- a/liboctave/system/lo-sysdep.cc
+++ b/liboctave/system/lo-sysdep.cc
@@ -140,37 +140,4 @@
   return pid;
 }
 
-void
-w32_clear_console_window (void)
-{
-  HANDLE console = GetStdHandle (STD_OUTPUT_HANDLE);
-
-  // Get the number of character cells in the current buffer.
-
-  CONSOLE_SCREEN_BUFFER_INFO csbi; 
-
-  if (GetConsoleScreenBufferInfo (console, &csbi))
-    {
-      DWORD screen_size = csbi.dwSize.X * csbi.dwSize.Y;
-
-      // Fill the entire screen with blanks.
-
-      COORD home = { 0, 0 };
-      DWORD nchars;
-
-      if (FillConsoleOutputCharacter (console, static_cast<TCHAR> (' '),
-                                      screen_size, home, &nchars))
-        {
-          if (GetConsoleScreenBufferInfo (console, &csbi))
-            {
-              if (FillConsoleOutputAttribute (console, csbi.wAttributes,
-                                              screen_size, home, &nchars))
-                {
-                  SetConsoleCursorPosition (console, home);
-                }
-            }
-        }
-    }
-}
-
 #endif
--- a/liboctave/system/lo-sysdep.h
+++ b/liboctave/system/lo-sysdep.h
@@ -35,9 +35,6 @@
 #if defined (__WIN32__) && ! defined (__CYGWIN__)
 extern pid_t octave_popen2 (const std::string&, const string_vector&,
     bool, int *, std::string&);
-
-extern void w32_clear_console_window (void);
-
 #endif
 
 #endif
--- a/liboctave/util/cmd-edit.cc
+++ b/liboctave/util/cmd-edit.cc
@@ -38,7 +38,6 @@
 #include "cmd-hist.h"
 #include "file-ops.h"
 #include "lo-error.h"
-#include "lo-sysdep.h"
 #include "lo-utils.h"
 #include "oct-env.h"
 #include "oct-mutex.h"
@@ -318,11 +317,7 @@
 void
 gnu_readline::do_clear_screen (void)
 {
-#if defined (__WIN32__) && ! defined (__CYGWIN__)
-  w32_clear_console_window ();
-#else
   ::octave_rl_clear_screen ();
-#endif
 }
 
 void
--- a/liboctave/util/oct-rl-edit.c
+++ b/liboctave/util/oct-rl-edit.c
@@ -93,6 +93,15 @@
 void
 octave_rl_clear_screen (void)
 {
+  /* This is a bit of a kluge, but I think it will work (I know, famous
+     last words).  */
+
+#if defined (__WIN32__) && ! defined (__CYGWIN__)
+
+  system ("cls");
+
+#else
+
   int ignore1 = 0;
   int ignore2 = 0;
 
@@ -102,6 +111,8 @@
   rl_clear_screen (ignore1, ignore2);
 
   rl_redisplay_function = saved_redisplay_function;
+
+#endif
 }
 
 void