gobject-introspection r256 - in trunk: . giscanner



Author: johan
Date: Mon Apr 28 22:37:23 2008
New Revision: 256
URL: http://svn.gnome.org/viewvc/gobject-introspection?rev=256&view=rev

Log:
2008-04-28  Johan Dahlin  <johan gnome org>

    * giscanner/xmlwriter.py: Calculate the line length properly,
    include the provided extra indentation in the calculation, really.



Modified:
   trunk/ChangeLog
   trunk/giscanner/xmlwriter.py

Modified: trunk/giscanner/xmlwriter.py
==============================================================================
--- trunk/giscanner/xmlwriter.py	(original)
+++ trunk/giscanner/xmlwriter.py	Mon Apr 28 22:37:23 2008
@@ -38,15 +38,15 @@
             return -1
         attr_length = 0
         for attr, value in attributes:
-            attr_length += 1 + len(attr) + len(quoteattr(value))
+            attr_length += 2 + len(attr) + len(quoteattr(value))
         return attr_length + indent
 
-    def _collect_attributes(self, attributes, indent=-1):
+    def _collect_attributes(self, attributes, extra_indent=-1):
         if not attributes:
             return ''
-
-        if self._calc_attrs_length(attributes, indent) > 79:
-            indent_len = self._indent + indent
+        extra_indent += len(self._indent_char) * self._indent
+        if self._calc_attrs_length(attributes, extra_indent) > 79:
+            indent_len = extra_indent
         else:
             indent_len = 0
         first = True
@@ -62,7 +62,7 @@
 
     def _open_tag(self, tag_name, attributes=None):
         attrs = self._collect_attributes(
-            attributes, len(tag_name) + 1)
+            attributes, len(tag_name) + 2)
         self.write_line('<%s%s>' % (tag_name, attrs))
 
     def _close_tag(self, tag_name):



[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]