2007-04-16 Jeffrey Stedfast <fejj@novell.com>
authorJeffrey Stedfast <fejj@novell.com>
Mon, 16 Apr 2007 22:52:32 +0000 (22:52 -0000)
committerJeffrey Stedfast <fejj@novell.com>
Mon, 16 Apr 2007 22:52:32 +0000 (22:52 -0000)
* WindowsConsoleDriver.cs: Get rid of unused Echo property.

* NullConsoleDriver.cs: Get rid of Echo property.

* IConsoleDriver.cs: Get rid of Echo property.

* ConsoleDriver.cs (Echo::get/set): Removed, not needed.

* TermInfoDriver.cs (Echo::get/set): Removed, this isn't necessary
and is confusing.
(ReadKey): If we are intercepting the key, call SetEcho (false)
and then reset back to true after reading the key.
(ReadLine): Same idea here.
(GetCursorPosition): We no longer need to keep track of the
previous echo state, we no longer have it :)

svn path=/trunk/mcs/; revision=75793

mcs/class/corlib/System/ChangeLog
mcs/class/corlib/System/ConsoleDriver.cs
mcs/class/corlib/System/IConsoleDriver.cs
mcs/class/corlib/System/NullConsoleDriver.cs
mcs/class/corlib/System/TermInfoDriver.cs
mcs/class/corlib/System/WindowsConsoleDriver.cs

index e805172491d4d135b213b1337db29c582bb8bd19..4cf8801667c2e0ab5354027e4c75721b353488d4 100644 (file)
@@ -1,3 +1,21 @@
+2007-04-16  Jeffrey Stedfast  <fejj@novell.com>
+
+       * WindowsConsoleDriver.cs: Get rid of unused Echo property.
+
+       * NullConsoleDriver.cs: Get rid of Echo property.
+
+       * IConsoleDriver.cs: Get rid of Echo property.
+
+       * ConsoleDriver.cs (Echo::get/set): Removed, not needed.
+
+       * TermInfoDriver.cs (Echo::get/set): Removed, this isn't necessary
+       and is confusing.
+       (ReadKey): If we are intercepting the key, call SetEcho (false)
+       and then reset back to true after reading the key.
+       (ReadLine): Same idea here.
+       (GetCursorPosition): We no longer need to keep track of the
+       previous echo state, we no longer have it :)
+
 2007-04-16  Jeffrey Stedfast  <fejj@novell.com>
 
        Fix for bug #80710 (and a bug I introduced in my last fix due to
index af50fb8cfa0e4f81fc38ad5ca7862c4e240c35f5..13cc0545fc5b424be98a71cd1b67acad742e26e6 100644 (file)
@@ -48,11 +48,6 @@ namespace System {
                        }
                }
 
-               public static bool Echo {
-                       get { return driver.Echo; }
-                       set { driver.Echo = value; }
-               }
-
                public static bool Initialized {
                        get { return driver.Initialized; }
                }
index a51f11fdee7cb80519dab93fa29171a84bf68d06..a503f2121af78c7bab1b2fd87566a0af62b5f0ec 100644 (file)
@@ -37,7 +37,6 @@ namespace System {
                int CursorSize { get; set; } 
                int CursorTop { get; set; }
                bool CursorVisible { get; set; }
-               bool Echo { get; set; }  // mono
                ConsoleColor ForegroundColor { get; set; }
                bool KeyAvailable { get; }
                bool Initialized { get; }
index 49b5e6bca69dcb563eeb0283d3d490f849eed553..62ff6912be1cc01f878746711ae4ac7499ca7520 100644 (file)
@@ -71,11 +71,6 @@ namespace System {
                        set {}
                }
 
-               public bool Echo { // not really used on windows
-                       get { return true; }
-                       set {}
-               }
-
                public ConsoleColor ForegroundColor {
                        get { return ConsoleColor.Black; }
                        set {}
index 041db228b1a07b2cc1e3d7321455df5d07d9c0c5..e3e4df58ecae17b368361ff95e63efd53f3ef848 100644 (file)
@@ -70,7 +70,6 @@ namespace System {
                bool controlCAsInput;
                bool inited;
                bool initKeys;
-               bool echo = true;
                string origPair;
                string origColors;
                string cursorAddress;
@@ -163,7 +162,6 @@ namespace System {
                                throw new IOException ("Not a tty.");
 
                        inited = true;
-                       ConsoleDriver.SetEcho (echo);
                        string endString = null;
                        keypadXmit = reader.Get (TermInfoStrings.KeypadXmit);
                        keypadLocal = reader.Get (TermInfoStrings.KeypadLocal);
@@ -370,13 +368,12 @@ namespace System {
                        }
                }
 
-               // Only used once.
+               // Only used once from within Init()
                void GetCursorPosition ()
                {
                        int row = 0, col = 0;
                        
-                       if (echo)
-                               ConsoleDriver.SetEcho (false);
+                       ConsoleDriver.SetEcho (false);
                        
                        try {
                                WriteConsole ("\x1b[6n");
@@ -424,8 +421,7 @@ namespace System {
                                        col --;
                                }
                        } finally {
-                               if (echo)
-                                       ConsoleDriver.SetEcho (true);
+                               ConsoleDriver.SetEcho (true);
                        }
 
                        cursorLeft = col;
@@ -547,30 +543,6 @@ namespace System {
 
                }
 
-               public bool Echo {
-                       get {
-                               if (!inited)
-                                       Init ();
-                               
-                               return echo;
-                       }
-                       set {
-                               if (echo == value) {
-                                       if (!inited)
-                                               Init ();
-                                       return;
-                               }
-                               
-                               echo = value;
-                               
-                               // Init() will call SetEcho(echo) for us
-                               if (inited)
-                                       ConsoleDriver.SetEcho (echo);
-                               else
-                                       Init ();
-                       }
-               }
-
                public bool KeyAvailable {
                        get {
                                if (!inited) {
@@ -878,19 +850,26 @@ namespace System {
 
                public ConsoleKeyInfo ReadKey (bool intercept)
                {
-                       bool prevEcho = echo;
+                       if (!inited)
+                               Init ();
+                       
+                       if (intercept)
+                               ConsoleDriver.SetEcho (false);
                        
-                       Echo = !intercept;
                        ConsoleKeyInfo key = ReadKeyInternal ();
-                       Echo = prevEcho;
+                       
+                       if (intercept)
+                               ConsoleDriver.SetEcho (true);
                        
                        return key;
                }
 
                public string ReadLine ()
                {
-                       bool prevEcho = echo;
-                       Echo = false;
+                       if (!inited)
+                               Init ();
+                       
+                       ConsoleDriver.SetEcho (false);
                        
                        StringBuilder builder = new StringBuilder ();
                        bool exit = false;
@@ -912,15 +891,15 @@ namespace System {
                                        }
                                }
                                
-                               if (prevEcho) {
-                                       // echo the key back to the console
-                                       if (writer != null)
-                                               writer.WriteKey (key);
-                                       else
-                                               Console.stdout.Write (c);
-                               }
+                               // echo the key back to the console
+                               if (writer != null)
+                                       writer.WriteKey (key);
+                               else
+                                       Console.stdout.Write (c);
                        } while (!exit);
-                       Echo = prevEcho;
+                       
+                       ConsoleDriver.SetEcho (true);
+                       
                        rl_startx = -1;
                        rl_starty = -1;
                        return builder.ToString ();
index 983c91e94649e903852610de00a9fd544b968a2c..8ecc4499f4e94c830e3ca90eec081c22509a9593 100644 (file)
@@ -236,11 +236,6 @@ namespace System {
                        }
                }
 
-               public bool Echo { // not really used on windows
-                       get { return true; }
-                       set {}
-               }
-
                public ConsoleColor ForegroundColor {
                        get {
                                ConsoleScreenBufferInfo info = new ConsoleScreenBufferInfo ();