From fd003083b6954ec1d5827984abb8ed61de400915 Mon Sep 17 00:00:00 2001 From: Anthon van der Neut Date: Thu, 16 May 2019 00:31:23 +0200 Subject: fix comments on anchored nodes in block sequence fixes issue #288 --- emitter.py | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) (limited to 'emitter.py') 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: -- cgit v1.2.1