Author: lluis
Date: 2007-02-09 07:38:14 -0500 (Fri, 09 Feb 2007)
New Revision: 72532

Modified:
   trunk/monodevelop/Extras/MonoDevelop.Autotools/ChangeLog
   trunk/monodevelop/Extras/MonoDevelop.Autotools/CustomMakefile.cs
Log:
* CustomMakefile.cs: Avoid adding or removing blank lines around
  variables.

Modified: trunk/monodevelop/Extras/MonoDevelop.Autotools/ChangeLog
===================================================================
--- trunk/monodevelop/Extras/MonoDevelop.Autotools/ChangeLog    2007-02-09 
07:53:18 UTC (rev 72531)
+++ trunk/monodevelop/Extras/MonoDevelop.Autotools/ChangeLog    2007-02-09 
12:38:14 UTC (rev 72532)
@@ -1,3 +1,8 @@
+2007-02-09  Lluis Sanchez Gual <[EMAIL PROTECTED]> 
+
+       * CustomMakefile.cs: Avoid adding or removing blank lines around
+         variables.
+
 2007-02-09  Ankit Jain <[EMAIL PROTECTED]> 
 
        * MakefileOptionPanelWidget.cs: Add a null check.

Modified: trunk/monodevelop/Extras/MonoDevelop.Autotools/CustomMakefile.cs
===================================================================
--- trunk/monodevelop/Extras/MonoDevelop.Autotools/CustomMakefile.cs    
2007-02-09 07:53:18 UTC (rev 72531)
+++ trunk/monodevelop/Extras/MonoDevelop.Autotools/CustomMakefile.cs    
2007-02-09 12:38:14 UTC (rev 72532)
@@ -108,14 +108,13 @@
                                return null;
                        
                        StringBuilder sb = new StringBuilder ();
-                       sb.AppendFormat ("\n{0} = ", var);
+                       sb.AppendFormat ("{0} = ", var);
                        if (list.Count > 1) {
                                foreach (string s in list)
                                        sb.AppendFormat (" \\\n\t{0}", s);
                        } else if (list.Count == 1) {
                                sb.Append (list [0]);
                        }
-                       sb.Append ("\n");
 
                        return sb.ToString ();
                }
@@ -212,18 +211,21 @@
                void SaveVariable (string var)
                {
                        //FIXME: Make this static
-                       Regex varExp = new Regex(@"[.|\n]*^" + var + 
@"((?<sep>\s*:?=\s*\n)|((?<sep>\s*:?=\s*)" + multilineMatch + "))", 
+                       Regex varExp = new Regex(@"[.|\n]*^(?<var>" + var + 
@"((?<sep>\s*:?=\s*\n)|((?<sep>\s*:?=\s*)" + multilineMatch + ")))", 
                                RegexOptions.Multiline);
                        
                        Match match = varExp.Match (content);
                        if (!match.Success) 
                                return;
 
+                       Group grp = match.Groups ["var"];
+                       int varLength = grp.ToString ().Trim (' ','\n').Length;
+                       
                        //FIXME: Umm too expensive
-                       content = String.Format ("{0}{1}{2}", 
-                                       content.Substring (0, match.Index),
+                       content = String.Concat ( 
+                                       content.Substring (0, grp.Index),
                                        GetVariable (var),
-                                       content.Substring (match.Index + 
match.Length));
+                                       content.Substring (grp.Index + 
varLength));
                }
 
                public void Save ()

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

Reply via email to