diff options
author | Anthon van der Neut <anthon@mnt.org> | 2018-08-08 16:10:57 +0200 |
---|---|---|
committer | Anthon van der Neut <anthon@mnt.org> | 2018-08-08 16:10:57 +0200 |
commit | 65c335bcf426d4954c079eda2cc5414259bea4f9 (patch) | |
tree | dce25671ea764c0ed0c7e32054ca6cecd32a91a8 /emitter.py | |
parent | 923a95aed72e446275995a5c8d83dd034099702c (diff) | |
download | ruamel.yaml-65c335bcf426d4954c079eda2cc5414259bea4f9.tar.gz |
fix issue #216: adding spaces when empty line and shrinking key
Diffstat (limited to 'emitter.py')
-rw-r--r-- | emitter.py | 6 |
1 files changed, 5 insertions, 1 deletions
@@ -1524,7 +1524,11 @@ class Emitter(object): try: # get original column position col = comment.start_mark.column - if col < self.column + 1: + if comment.value and comment.value.startswith('\n'): + # never inject extra spaces if the comment starts with a newline + # and not a real comment (e.g. if you have an empty line following a key-value + col = self.column + elif col < self.column + 1: ValueError except ValueError: col = self.column + 1 |