Author: fejj
Date: 2007-07-18 15:27:08 -0400 (Wed, 18 Jul 2007)
New Revision: 82231

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

        * FormattingStrategy/CSharpIndentEngine.cs: A few fixes, including
        one for bug #82055.



Modified: trunk/monodevelop/Extras/CSharpBinding/ChangeLog
===================================================================
--- trunk/monodevelop/Extras/CSharpBinding/ChangeLog    2007-07-18 19:16:46 UTC 
(rev 82230)
+++ trunk/monodevelop/Extras/CSharpBinding/ChangeLog    2007-07-18 19:27:08 UTC 
(rev 82231)
@@ -1,5 +1,8 @@
 2007-07-18  Jeffrey Stedfast  <[EMAIL PROTECTED]>
 
+       * FormattingStrategy/CSharpIndentEngine.cs: A few fixes, including
+       one for bug #82055.
+
        * Gui/CSharpTextEditorExtension.cs (IsInUsing): Simplified.
        (GetPreviousToken): Fixed bug #82131.
 

Modified: 
trunk/monodevelop/Extras/CSharpBinding/FormattingStrategy/CSharpIndentEngine.cs
===================================================================
--- 
trunk/monodevelop/Extras/CSharpBinding/FormattingStrategy/CSharpIndentEngine.cs 
    2007-07-18 19:16:46 UTC (rev 82230)
+++ 
trunk/monodevelop/Extras/CSharpBinding/FormattingStrategy/CSharpIndentEngine.cs 
    2007-07-18 19:27:08 UTC (rev 82231)
@@ -256,6 +256,7 @@
                        string str = linebuf.ToString (wordStart, 
linebuf.Length - wordStart);
                        string[] keywords = new string [] {
                                "namespace",
+                               "interface",
                                "struct",
                                "class",
                                "enum",
@@ -297,6 +298,10 @@
                            !KeywordIsSpecial (keyword)) {
                                keyword = String.Empty;
                                return;
+                       } else if (stack.PeekInside (0) == 
Inside.FoldedStatement &&
+                                  (keyword == "base" || keyword == "class" || 
keyword == "interface")) {
+                               // don't push another folded statement in this 
case either...
+                               return;
                        }
                        
                        stack.Push (Inside.FoldedStatement, keyword, curLineNr, 
0);
@@ -567,15 +572,18 @@
                        
                        // push a new block onto the stack
                        if (inside == Inside.FoldedStatement) {
-                               string pKeyword = stack.PeekKeyword (0);
+                               string pKeyword;
                                
-                               stack.Pop ();
+                               if (firstNonLwsp == -1) {
+                                       pKeyword = stack.PeekKeyword (1);
+                                       stack.Pop ();
+                               } else
+                                       pKeyword = keyword;
                                
-                               if ((pKeyword == "base" || pKeyword == "this" 
|| pKeyword == "class") &&
-                                   stack.PeekInside (0) == 
Inside.FoldedStatement) {
-                                       // Folded Constructor or class
-                                       pKeyword = stack.PeekKeyword (0);
-                                       stack.Pop ();
+                               if (pKeyword == "base" || pKeyword == "this" || 
pKeyword == "class" || pKeyword == "interface") {
+                                       // folded ctor or class
+                                       while (stack.PeekInside (0) == 
Inside.FoldedStatement)
+                                               stack.Pop ();
                                }
                                
                                if (firstNonLwsp == -1)
@@ -625,6 +633,9 @@
                        
                        stack.Pop ();
                        
+                       while (stack.PeekInside (0) == Inside.FoldedStatement)
+                               stack.Pop ();
+                       
                        if (firstNonLwsp == -1) {
                                needsReindent = true;
                                TrimIndent ();
@@ -711,6 +722,9 @@
                                case ';':
                                        // handled elsewhere
                                        break;
+                               case ',':
+                                       // avoid indenting if we are in a list
+                                       break;
                                default:
                                        if (stack.PeekLineNr (0) == curLineNr) {
                                                // is this right? I don't 
remember why I did this...
@@ -718,13 +732,6 @@
                                        }
                                        
                                        if (inside == Inside.Block) {
-                                               if (pc == ',') {
-                                                       // avoid indenting if 
we are in a list
-                                                       /* Note: this may 
negate the need for checking
-                                                        * for "enum" and 
"struct" below */
-                                                       break;
-                                               }
-                                               
                                                if (stack.PeekKeyword (0) == 
"struct" ||
                                                    stack.PeekKeyword (0) == 
"enum" ||
                                                    stack.PeekKeyword (0) == 
"=") {

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

Reply via email to