Include indentation in line length calculation
authorJohan Dahlin <johan@gnome.org>
Mon, 28 Apr 2008 02:12:17 +0000 (02:12 +0000)
committerJohan Dahlin <johan@src.gnome.org>
Mon, 28 Apr 2008 02:12:17 +0000 (02:12 +0000)
2008-04-27  Johan Dahlin  <johan@gnome.org>

        * giscanner/xmlwriter.py:
        * tests/parser/Foo-expected.gir:
        Include indentation in line length calculation

svn path=/trunk/; revision=239

ChangeLog
giscanner/xmlwriter.py
tests/parser/Foo-expected.gir

index 8045843..f75859a 100644 (file)
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,5 +1,11 @@
 2008-04-27  Johan Dahlin  <johan@gnome.org>
 
+       * giscanner/xmlwriter.py:
+       * tests/parser/Foo-expected.gir:
+       Include indentation in line length calculation
+
+2008-04-27  Johan Dahlin  <johan@gnome.org>
+
        * giscanner/girparser.py:
        Prettify NS parsing using elementtree.
 
index 53926d7..cfb8a77 100644 (file)
@@ -32,17 +32,19 @@ class XMLWriter(object):
 
     # Private
 
-    def _calc_attrs_length(self, attributes):
+    def _calc_attrs_length(self, attributes, indent):
+        if indent == -1:
+            return -1
         attr_length = 0
         for attr, value in attributes:
             attr_length += 1 + len(attr) + len(quoteattr(value))
-        return attr_length
+        return attr_length + indent
 
     def _collect_attributes(self, attributes, indent=-1):
         if not attributes:
             return ''
 
-        if indent != -1 and self._calc_attrs_length(attributes) > 79:
+        if self._calc_attrs_length(attributes, indent) > 79:
             indent_len = self._indent + indent
         else:
             indent_len = 0
index 6dee16a..4996e05 100644 (file)
       <member name="FOO_ENUM_DEUX" value="2"/>
       <member name="FOO_ENUM_TROIS" value="3"/>
     </enumeration>
-    <glib:boxed glib:name="Boxed" glib:type-name="FooBoxed" glib:get-type="foo_boxed_get_type">
+    <glib:boxed glib:name="Boxed"
+                glib:type-name="FooBoxed"
+                glib:get-type="foo_boxed_get_type">
       <constructor name="new" c:identifier="foo_boxed_new">
         <return-value c:identifer="Boxed*">
           <type name="Boxed*"/>