Author: fejj
Date: 2007-04-20 18:10:42 -0400 (Fri, 20 Apr 2007)
New Revision: 76027

Modified:
   branches/mono-1-2-4/mcs/class/corlib/System/CStreamWriter.cs
   branches/mono-1-2-4/mcs/class/corlib/System/ChangeLog
   branches/mono-1-2-4/mcs/class/corlib/System/TermInfoDriver.cs
Log:
2007-04-20  Jeffrey Stedfast  <[EMAIL PROTECTED]>

        * TermInfoDriver.cs (QueueEcho): Renamed from Echo(char). Use
        CStreamWriter's new InternalWriteChars().
        (Echo): Since we can no longer go thru CStreamWriter's ::Write()
        method that does checks for special keys, do the checks here
        instead - if it is a special key, flush the echo buffer and then
        write the special key.
        (EchoFlush): Also updated to use CStreamWriter's new
        InternalWriteChars().
        (Read): Use the Echo(key) variety.
        (ReadKey): Same.
        (ReadLine): And here too.

        * CStreamWriter.cs (InternalWriteChars): Write a char array
        directly to stdout. Do not pass Go, do not collect $200.



Modified: branches/mono-1-2-4/mcs/class/corlib/System/CStreamWriter.cs
===================================================================
--- branches/mono-1-2-4/mcs/class/corlib/System/CStreamWriter.cs        
2007-04-20 21:46:57 UTC (rev 76026)
+++ branches/mono-1-2-4/mcs/class/corlib/System/CStreamWriter.cs        
2007-04-20 22:10:42 UTC (rev 76027)
@@ -138,6 +138,14 @@
                        }
                }
 
+               public void InternalWriteChars (char [] buffer, int n)
+               {
+                       try {
+                               base.Write (buffer, 0, n);
+                       } catch (IOException) {
+                       }
+               }
+
                public override void Write (char [] val)
                {
                        Write (val, 0, val.Length);

Modified: branches/mono-1-2-4/mcs/class/corlib/System/ChangeLog
===================================================================
--- branches/mono-1-2-4/mcs/class/corlib/System/ChangeLog       2007-04-20 
21:46:57 UTC (rev 76026)
+++ branches/mono-1-2-4/mcs/class/corlib/System/ChangeLog       2007-04-20 
22:10:42 UTC (rev 76027)
@@ -1,3 +1,20 @@
+2007-04-20  Jeffrey Stedfast  <[EMAIL PROTECTED]>
+
+       * TermInfoDriver.cs (QueueEcho): Renamed from Echo(char). Use
+       CStreamWriter's new InternalWriteChars().
+       (Echo): Since we can no longer go thru CStreamWriter's ::Write()
+       method that does checks for special keys, do the checks here
+       instead - if it is a special key, flush the echo buffer and then
+       write the special key.
+       (EchoFlush): Also updated to use CStreamWriter's new
+       InternalWriteChars().
+       (Read): Use the Echo(key) variety.
+       (ReadKey): Same.
+       (ReadLine): And here too.
+
+       * CStreamWriter.cs (InternalWriteChars): Write a char array
+       directly to stdout. Do not pass Go, do not collect $200.
+
 2007-04-19  Jeffrey Stedfast  <[EMAIL PROTECTED]>
 
        Optimization for echoing keypresses back to the console when the

Modified: branches/mono-1-2-4/mcs/class/corlib/System/TermInfoDriver.cs
===================================================================
--- branches/mono-1-2-4/mcs/class/corlib/System/TermInfoDriver.cs       
2007-04-20 21:46:57 UTC (rev 76026)
+++ branches/mono-1-2-4/mcs/class/corlib/System/TermInfoDriver.cs       
2007-04-20 22:10:42 UTC (rev 76027)
@@ -889,7 +889,7 @@
                int echon = 0;
 
                // Queues a character to be echo'd back to the console
-               void Echo (char c)
+               void QueueEcho (char c)
                {
                        if (echobuf == null)
                                echobuf = new char [1024];
@@ -898,7 +898,7 @@
 
                        if (echon == echobuf.Length || !InputPending ()) {
                                // blit our echo buffer to the console
-                               Console.Write (echobuf, 0, echon);
+                               ((CStreamWriter) 
Console.stdout).InternalWriteChars (echobuf, echon);
                                echon = 0;
                        }
                }
@@ -906,7 +906,15 @@
                // Queues a key to be echo'd back to the console
                void Echo (ConsoleKeyInfo key)
                {
-                       Echo (key.KeyChar);
+                       if (!IsSpecialKey (key)) {
+                               QueueEcho (key.KeyChar);
+                               return;
+                       }
+
+                       // flush pending echo's
+                       EchoFlush ();
+
+                       WriteSpecialKey (key);
                }
 
                // Flush the pending echo queue
@@ -916,7 +924,7 @@
                                return;
 
                        // flush our echo buffer to the console
-                       Console.Write (echobuf, 0, echon);
+                       ((CStreamWriter) Console.stdout).InternalWriteChars 
(echobuf, echon);
                        echon = 0;
                }
 #endregion
@@ -971,7 +979,7 @@
 
                                // echo fresh keys back to the console
                                if (fresh)
-                                       Echo (c);
+                                       Echo (key);
                        } while (key.Key != ConsoleKey.Enter);
 
                        EchoFlush ();
@@ -1002,7 +1010,7 @@
 
                        if (!intercept && fresh) {
                                // echo the fresh key back to the console
-                               Echo (key.KeyChar);
+                               Echo (key);
                                EchoFlush ();
                        }
 
@@ -1031,11 +1039,11 @@
                                key = ReadKeyInternal (out fresh);
                                c = key.KeyChar;
                                if (key.Key != ConsoleKey.Enter) {
-                                       if (key.Key != ConsoleKey.Backspace)
+                                       if (key.Key != ConsoleKey.Backspace) {
                                                builder.Append (c);
-                                       else if (builder.Length > 0)
+                                       } else if (builder.Length > 0) {
                                                builder.Length--;
-                                       else {
+                                       } else {
                                                // skips over echoing the key 
to the console
                                                continue;
                                        }
@@ -1043,7 +1051,7 @@
 
                                // echo fresh keys back to the console
                                if (fresh)
-                                       Echo (c);
+                                       Echo (key);
                        } while (key.Key != ConsoleKey.Enter);
 
                        EchoFlush ();

_______________________________________________
Mono-patches maillist  -  [email protected]
http://lists.ximian.com/mailman/listinfo/mono-patches

Reply via email to