summaryrefslogtreecommitdiff
path: root/emitter.py
diff options
context:
space:
mode:
authorAnthon van der Neut <anthon@mnt.org>2019-05-16 00:31:23 +0200
committerAnthon van der Neut <anthon@mnt.org>2019-05-16 00:31:23 +0200
commitfd003083b6954ec1d5827984abb8ed61de400915 (patch)
tree3cef27f13dd41f9a3c019e06912805245a78f715 /emitter.py
parent399330be1abc4ab510cc4dabe8ff1bb2378dc08f (diff)
downloadruamel.yaml-fd003083b6954ec1d5827984abb8ed61de400915.tar.gz
fix comments on anchored nodes in block sequence0.15.95
fixes issue #288
Diffstat (limited to 'emitter.py')
-rw-r--r--emitter.py5
1 files changed, 3 insertions, 2 deletions
diff --git a/emitter.py b/emitter.py
index d4884bd..0ed1932 100644
--- a/emitter.py
+++ b/emitter.py
@@ -421,7 +421,6 @@ class Emitter(object):
self.indention = False
self.no_newline = True
if self.write_pre_comment(self.event):
- pass
self.indention = i2
self.no_newline = not self.indention
if (
@@ -780,6 +779,8 @@ class Emitter(object):
self.prepared_anchor = self.prepare_anchor(self.event.anchor)
if self.prepared_anchor:
self.write_indicator(indicator + self.prepared_anchor, True)
+ # issue 288
+ self.no_newline = False
self.prepared_anchor = None
return True
@@ -1631,7 +1632,7 @@ class Emitter(object):
# at least one space if the current column >= the start column of the comment
# but not at the start of a line
nr_spaces = col - self.column
- if self.column and value.strip() and nr_spaces < 1:
+ if self.column and value.strip() and nr_spaces < 1 and value[0] != '\n':
nr_spaces = 1
value = ' ' * nr_spaces + value
try: