X-Git-Url: http://wien.tomnetworks.com/gitweb/?a=blobdiff_plain;f=mcs%2Ftools%2Fcsharp%2Fgetline.cs;h=63ff480118bb61e82f6f46a87196ffe2d361da06;hb=9eed92664c66781ab31f3c9590c5b8f5306870f4;hp=d95ecdbbeb25877d86466994cfa899a0dc3bcc36;hpb=f574568932c5c84611599d356f068a5c515d36e7;p=mono.git diff --git a/mcs/tools/csharp/getline.cs b/mcs/tools/csharp/getline.cs index d95ecdbbeb2..63ff480118b 100644 --- a/mcs/tools/csharp/getline.cs +++ b/mcs/tools/csharp/getline.cs @@ -22,9 +22,6 @@ // Console needs a way of updating its position after things have been written // behind its back (P/Invoke puts for example). // System.Console needs to get the DELETE character, and report accordingly. -// Typing before the program start causes the cursor position to be wrong -// This is caused by Console not reading all the available data -// before sending the report-position sequence and reading it back. // #if NET_2_0 || NET_1_1 #define IN_MCS_BUILD @@ -191,7 +188,7 @@ namespace Mono.Terminal { Handler.Alt ((char) 8, ConsoleKey.Backspace, CmdDeleteBackword), // DEBUG - Handler.Control ('T', CmdDebug), + //Handler.Control ('T', CmdDebug), // quote Handler.Control ('Q', delegate { HandleChar (Console.ReadKey (true).KeyChar); }) @@ -769,13 +766,22 @@ namespace Mono.Terminal { ConsoleKeyInfo cki; while (!done){ + ConsoleModifiers mod; + cki = Console.ReadKey (true); + if (cki.Key == ConsoleKey.Escape){ + cki = Console.ReadKey (true); + mod = ConsoleModifiers.Alt; + } else + mod = cki.Modifiers; + bool handled = false; + foreach (Handler handler in handlers){ ConsoleKeyInfo t = handler.CKI; - if (t.Key == cki.Key && t.Modifiers == cki.Modifiers){ + if (t.Key == cki.Key && t.Modifiers == mod){ handled = true; handler.KeyHandler (); last_handler = handler.KeyHandler; @@ -985,7 +991,7 @@ namespace Mono.Terminal { public bool NextAvailable () { int next = (cursor + 1) % history.Length; - if (count == 0 || next > head) + if (count == 0 || next >= head) return false; return true;