* 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
+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
}
}
- public static bool Echo {
- get { return driver.Echo; }
- set { driver.Echo = value; }
- }
-
public static bool Initialized {
get { return driver.Initialized; }
}
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; }
set {}
}
- public bool Echo { // not really used on windows
- get { return true; }
- set {}
- }
-
public ConsoleColor ForegroundColor {
get { return ConsoleColor.Black; }
set {}
bool controlCAsInput;
bool inited;
bool initKeys;
- bool echo = true;
string origPair;
string origColors;
string cursorAddress;
throw new IOException ("Not a tty.");
inited = true;
- ConsoleDriver.SetEcho (echo);
string endString = null;
keypadXmit = reader.Get (TermInfoStrings.KeypadXmit);
keypadLocal = reader.Get (TermInfoStrings.KeypadLocal);
}
}
- // 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");
col --;
}
} finally {
- if (echo)
- ConsoleDriver.SetEcho (true);
+ ConsoleDriver.SetEcho (true);
}
cursorLeft = col;
}
- 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) {
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;
}
}
- 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 ();
}
}
- public bool Echo { // not really used on windows
- get { return true; }
- set {}
- }
-
public ConsoleColor ForegroundColor {
get {
ConsoleScreenBufferInfo info = new ConsoleScreenBufferInfo ();