Author: fejj
Date: 2007-07-18 12:51:53 -0400 (Wed, 18 Jul 2007)
New Revision: 82226

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

        * Gui/CSharpTextEditorExtension.cs (IsInUsing): Simplified.
        (GetPreviousToken): Fixed bug #82131.



Modified: trunk/monodevelop/Extras/CSharpBinding/ChangeLog
===================================================================
--- trunk/monodevelop/Extras/CSharpBinding/ChangeLog    2007-07-18 16:28:06 UTC 
(rev 82225)
+++ trunk/monodevelop/Extras/CSharpBinding/ChangeLog    2007-07-18 16:51:53 UTC 
(rev 82226)
@@ -1,3 +1,8 @@
+2007-07-18  Jeffrey Stedfast  <[EMAIL PROTECTED]>
+
+       * Gui/CSharpTextEditorExtension.cs (IsInUsing): Simplified.
+       (GetPreviousToken): Fixed bug #82131.
+
 2007-07-17  Jeffrey Stedfast  <[EMAIL PROTECTED]>
 
        * Gui/CSharpTextEditorExtension.cs (KeyPress): Fixed a bug caused

Modified: 
trunk/monodevelop/Extras/CSharpBinding/Gui/CSharpTextEditorExtension.cs
===================================================================
--- trunk/monodevelop/Extras/CSharpBinding/Gui/CSharpTextEditorExtension.cs     
2007-07-18 16:28:06 UTC (rev 82225)
+++ trunk/monodevelop/Extras/CSharpBinding/Gui/CSharpTextEditorExtension.cs     
2007-07-18 16:51:53 UTC (rev 82226)
@@ -342,7 +342,6 @@
                        
                        i = ctx.TriggerOffset;
                        if (charTyped == ' ' && GetPreviousToken ("override", 
ref i, false)) {
-                       
                                // Look for modifiers, in order to find the 
beginning of the declaration
                                int firstMod = i;
                                for (int n=0; n<3; n++) {
@@ -380,10 +379,11 @@
 
                        string ns;
                        if (IsInUsing (expression, ctx.TriggerOffset, out ns)) {
-                               if (charTyped == ' ' && ns != String.Empty)
+                               if (charTyped == ' ' && ns != String.Empty) {
                                        // 'using System' and charTyped == ' '
                                        // subnamespaces show up only on '.'
                                        return null;
+                               }
                                
                                Resolver res = new Resolver (parserContext);
                                // Don't show namespaces when "using" is not a 
namespace directive
@@ -415,15 +415,17 @@
                 *      using System. : ns - "System"
                 *      using System.Collections. : ns - "System.Collections"
                 */
-               bool IsInUsing (string expression, int triggerOffset, out 
string ns)
+               bool IsInUsing (string expr, int triggerOffset, out string ns)
                {
-                       ns = "";
-                       if (expression == "using" || expression.EndsWith(" 
using") || expression.EndsWith("\tusing")||
-                               expression.EndsWith("\nusing")|| 
expression.EndsWith("\rusing"))
+                       int len = expr.Length;
+                       
+                       ns = String.Empty;
+                       if (expr == "using" || (expr.EndsWith ("using") && 
char.IsWhiteSpace (expr[len - 5])))
                                return true;
-
-                       ns = expression;
-                       int i = triggerOffset - expression.Length - 1;
+                       
+                       ns = expr;
+                       int i = triggerOffset - expr.Length - 1;
+                       
                        return (GetPreviousToken (ref i, true) == "using");
                }
                
@@ -452,12 +454,13 @@
                        int endOffset = i + 1;
                        
                        do {
-                               c = Editor.GetCharAt (--i);
-                       } while (i > 0 && (char.IsLetterOrDigit (c) || c == 
'_'));
+                               c = Editor.GetCharAt (i - 1);
+                               if (!(char.IsLetterOrDigit (c) || c == '_'))
+                                       break;
+                               
+                               i--;
+                       } while (i > 0);
                        
-                       if (char.IsWhiteSpace (c))
-                               i++;
-                       
                        return Editor.GetText (i, endOffset);
                }
                

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

Reply via email to