Author: fejj
Date: 2007-03-07 17:19:44 -0500 (Wed, 07 Mar 2007)
New Revision: 73918

Modified:
   trunk/monodevelop/Extras/CSharpBinding/ChangeLog
   trunk/monodevelop/Extras/CSharpBinding/Gui/CSharpTextEditorExtension.cs
Log:
2007-03-07  Jeffrey Stedfast  <[EMAIL PROTECTED]>

        * Gui/CSharpTextEditorExtension.cs (KeyPress): Same sort of fix as
        earlier wrt the user hitting Tab. If the user hits <Enter> and the
        base class does not insert a '\n', then it means the user has just
        accepted an auto-completed selection. In this case, return -
        there's nothing left for us to do.



Modified: trunk/monodevelop/Extras/CSharpBinding/ChangeLog
===================================================================
--- trunk/monodevelop/Extras/CSharpBinding/ChangeLog    2007-03-07 22:15:39 UTC 
(rev 73917)
+++ trunk/monodevelop/Extras/CSharpBinding/ChangeLog    2007-03-07 22:19:44 UTC 
(rev 73918)
@@ -1,5 +1,11 @@
 2007-03-07  Jeffrey Stedfast  <[EMAIL PROTECTED]>
 
+       * Gui/CSharpTextEditorExtension.cs (KeyPress): Same sort of fix as
+       earlier wrt the user hitting Tab. If the user hits <Enter> and the
+       base class does not insert a '\n', then it means the user has just
+       accepted an auto-completed selection. In this case, return -
+       there's nothing left for us to do.
+
        * FormattingStrategy/CSharpIndentEngineStack.cs (Push): Added a
        work-around for pushing a multi-line anonmymous method {} block
        inside a ParenList (e.g. as a callback argument).
@@ -26,9 +32,9 @@
 
 2007-03-07  Jeffrey Stedfast  <[EMAIL PROTECTED]>
 
-       * Gui/CSharpTextEditorExtension.cs: Fixed a bug preventing
-       tab-completion from working by chaining the KeyPress() to the
-       parent.
+       * Gui/CSharpTextEditorExtension.cs (KeyPress): Fixed a bug
+       preventing tab-completion from working by chaining the KeyPress()
+       to the parent.
 
 2007-03-07  Jeffrey Stedfast  <[EMAIL PROTECTED]>
 

Modified: 
trunk/monodevelop/Extras/CSharpBinding/Gui/CSharpTextEditorExtension.cs
===================================================================
--- trunk/monodevelop/Extras/CSharpBinding/Gui/CSharpTextEditorExtension.cs     
2007-03-07 22:15:39 UTC (rev 73917)
+++ trunk/monodevelop/Extras/CSharpBinding/Gui/CSharpTextEditorExtension.cs     
2007-03-07 22:19:44 UTC (rev 73918)
@@ -101,6 +101,7 @@
                        case Gdk.Key.Return:
                        case Gdk.Key.KP_Enter:
                                reindent = true;
+                               insert = false;
                                c = '\n';
                                break;
                        default:
@@ -126,8 +127,14 @@
                                        return base.KeyPress (key, modifier);
                                
                                // Pass off to base.KeyPress() so the '\n' gets 
added to the Undo stack, etc
-                               base.KeyPress (key, modifier);
-                               insert = false;
+                               if (base.KeyPress (key, modifier)) {
+                                       // if the char inserted is not '\n', 
then it means the user used
+                                       // <Enter> to accept an auto-completion 
choice.
+                                       if (Editor.CursorPosition > cursor && 
Editor.GetCharAt (cursor) != '\n')
+                                               return true;
+                               }
+                               
+                               engine.Push ('\n');
                                cursor++;
                                
                                if (Editor.CursorPosition > cursor) {

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

Reply via email to