Welcome to mirror list, hosted at ThFree Co, Russian Federation.

github.com/mono/mono.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
Diffstat (limited to 'mcs/class/corlib/System/TermInfoDriver.cs')
-rw-r--r--mcs/class/corlib/System/TermInfoDriver.cs59
1 files changed, 21 insertions, 38 deletions
diff --git a/mcs/class/corlib/System/TermInfoDriver.cs b/mcs/class/corlib/System/TermInfoDriver.cs
index 99c3379aca7..67cb1a069c1 100644
--- a/mcs/class/corlib/System/TermInfoDriver.cs
+++ b/mcs/class/corlib/System/TermInfoDriver.cs
@@ -283,11 +283,9 @@ namespace System {
}
int b = stdin.ReadByte ();
- while (b != '\x1b') {
+ if (b != '\x1b') {
AddToBuffer (b);
- if (ConsoleDriver.InternalKeyAvailable (100) <= 0)
- return;
- b = stdin.ReadByte ();
+ return;
}
b = stdin.ReadByte ();
@@ -301,24 +299,18 @@ namespace System {
if (b != ';') {
row = b - '0';
b = stdin.ReadByte ();
- while ((b >= '0') && (b <= '9')) {
+ if (b != ';')
row = row * 10 + b - '0';
- b = stdin.ReadByte ();
- }
- // Row/col is 0 based
- row --;
}
b = stdin.ReadByte ();
if (b != 'R') {
col = b - '0';
b = stdin.ReadByte ();
- while ((b >= '0') && (b <= '9')) {
+ if (b != 'R') {
col = col * 10 + b - '0';
- b = stdin.ReadByte ();
+ stdin.ReadByte (); // This should be the 'R'
}
- // Row/col is 0 based
- col --;
}
} finally {
Echo = prevEcho;
@@ -453,25 +445,21 @@ namespace System {
void GetWindowDimensions ()
{
//TODO: Handle SIGWINCH
-
- /* Try the ioctl first */
- if (!ConsoleDriver.GetTtySize (MonoIO.ConsoleOutput, out windowWidth, out windowHeight)) {
- windowWidth = reader.Get (TermInfoNumbers.Columns);
- string env = Environment.GetEnvironmentVariable ("COLUMNS");
- if (env != null) {
- try {
- windowWidth = (int) UInt32.Parse (env);
- } catch {
- }
+ windowWidth = reader.Get (TermInfoNumbers.Columns);
+ string env = Environment.GetEnvironmentVariable ("COLUMNS");
+ if (env != null) {
+ try {
+ windowWidth = (int) UInt32.Parse (env);
+ } catch {
}
+ }
- windowHeight = reader.Get (TermInfoNumbers.Lines);
- env = Environment.GetEnvironmentVariable ("LINES");
- if (env != null) {
- try {
- windowHeight = (int) UInt32.Parse (env);
- } catch {
- }
+ windowHeight = reader.Get (TermInfoNumbers.Lines);
+ env = Environment.GetEnvironmentVariable ("LINES");
+ if (env != null) {
+ try {
+ windowHeight = (int) UInt32.Parse (env);
+ } catch {
}
}
@@ -551,17 +539,12 @@ namespace System {
ConsoleKeyInfo CreateKeyInfoFromInt (int n)
{
char c = (char) n;
- ConsoleKey key = (ConsoleKey)n;
+ ConsoleKey key = (ConsoleKey) n;
bool shift = false;
bool ctrl = false;
bool alt = false;
-
- if (n == 10) {
- key = ConsoleKey.Enter;
- } else if (n == 8 || n == 9 || n == 12 || n == 13 || n == 19) {
- /* Values in ConsoleKey */
- } else if (n >= 1 && n <= 26) {
- // For Ctrl-a to Ctrl-z.
+ // For Ctrl-a to Ctrl-z. Exception: those values in ConsoleKey
+ if (n >= 1 && n <= 26 && !(n == 8 || n == 9 || n == 12 || n == 13 || n == 19)) {
ctrl = true;
key = ConsoleKey.A + n - 1;
} else if (n == 27) {