summaryrefslogtreecommitdiff
path: root/emitter.py
diff options
context:
space:
mode:
authorAnthon van der Neut <anthon@mnt.org>2018-11-26 09:24:31 +0100
committerAnthon van der Neut <anthon@mnt.org>2018-11-26 09:24:31 +0100
commit10438bc786dc6a381193025779cf86e072a1108a (patch)
tree19880df160235f35b4e3443509a77e84bd560870 /emitter.py
parentfa720ebff5f3ee49cb70d3741d07e1f3fd957a62 (diff)
downloadruamel.yaml-10438bc786dc6a381193025779cf86e072a1108a.tar.gz
fix for issue with folds after (and before) spaces being emitted as BEL character instead of discarding0.15.80
Diffstat (limited to 'emitter.py')
-rw-r--r--emitter.py13
1 files changed, 8 insertions, 5 deletions
diff --git a/emitter.py b/emitter.py
index c410f2e..61ca269 100644
--- a/emitter.py
+++ b/emitter.py
@@ -156,8 +156,8 @@ class Emitter(object):
self.column = 0
self.whitespace = True
self.indention = True
- self.compact_seq_seq = True # dash after dash
- self.compact_seq_map = True # key after dash
+ self.compact_seq_seq = True # dash after dash
+ self.compact_seq_map = True # key after dash
# self.compact_ms = False # dash after key, only when excplicit key with ?
self.no_newline = None # type: Optional[bool] # set if directly after `- `
@@ -1463,9 +1463,12 @@ class Emitter(object):
data = data.encode(self.encoding)
self.stream.write(data)
if ch == u'\a':
- self.write_line_break()
- self.write_indent()
- end += 2 # \a and the space that is inserted on the fold
+ if end < (len(text) - 1) and not text[end + 2].isspace():
+ self.write_line_break()
+ self.write_indent()
+ end += 2 # \a and the space that is inserted on the fold
+ else:
+ raise EmitterError('unexcpected fold indicator \\a before space')
if ch is None:
self.write_line_break()
start = end