summaryrefslogtreecommitdiff
path: root/emitter.py
diff options
context:
space:
mode:
authorsixolet <naomi@seyfer.org>2018-09-11 11:02:44 -0700
committersixolet <naomi@seyfer.org>2018-09-11 11:02:44 -0700
commitc242392fb97608e4f0859163cecec34773146542 (patch)
treea7af79d626b2a9da782b2082b2da9ae51e7307fc /emitter.py
parentf2e5ad1e946a5401753a4058269f933c6d94fc62 (diff)
downloadruamel.yaml-c242392fb97608e4f0859163cecec34773146542.tar.gz
Stop explicitly-indented literals from stacking with flow-based indents.
Previously, when the emitter was writing a literal with an explicit indent, it would also apply the current block indent, which is incorrect. Now it only applies the explicit indent. This bug was introduced in https://bitbucket.org/ruamel/yaml/commits/b57e2dd549e2b561cb0b418a180365c1fde2722a
Diffstat (limited to 'emitter.py')
-rw-r--r--emitter.py9
1 files changed, 5 insertions, 4 deletions
diff --git a/emitter.py b/emitter.py
index 5bac4ae..b739a28 100644
--- a/emitter.py
+++ b/emitter.py
@@ -1485,10 +1485,11 @@ class Emitter(object):
self.write_line_break()
else:
self.write_line_break(br)
- if ch is not None and (not self.root_context or self.requested_indent):
- self.write_indent()
- if ch is not None and _indent:
- self.stream.write(u' ' * _indent)
+ if ch is not None:
+ if _indent:
+ self.stream.write(u' ' * _indent)
+ elif not self.root_context or self.requested_indent:
+ self.write_indent()
start = end
else:
if ch is None or ch in u'\n\x85\u2028\u2029':