summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorJohan Dahlin <johan@gnome.org>2008-04-28 22:37:23 +0000
committerJohan Dahlin <johan@src.gnome.org>2008-04-28 22:37:23 +0000
commitffbe20f528aaa923c420b77391a47b3976a71f86 (patch)
tree5bb8fbf4ef0a4e2d3d5c21adc55e4111d3832138
parentfeb328d2395743d44cb0f3532213ac4e06888d87 (diff)
downloadgobject-introspection-ffbe20f528aaa923c420b77391a47b3976a71f86.tar.gz
Calculate the line length properly, include the provided extra indentation
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. svn path=/trunk/; revision=256
-rw-r--r--ChangeLog5
-rw-r--r--giscanner/xmlwriter.py12
2 files changed, 11 insertions, 6 deletions
diff --git a/ChangeLog b/ChangeLog
index b379166c..b5d82c49 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,3 +1,8 @@
+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.
+
2008-04-28 Johan Dahlin <jdahlin@async.com.br>
* giscanner/ast.py:
diff --git a/giscanner/xmlwriter.py b/giscanner/xmlwriter.py
index 20631061..4dee3e2f 100644
--- a/giscanner/xmlwriter.py
+++ b/giscanner/xmlwriter.py
@@ -38,15 +38,15 @@ class XMLWriter(object):
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 @@ class XMLWriter(object):
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):