diff options
author | Anthon van der Neut <anthon@mnt.org> | 2018-11-26 09:24:31 +0100 |
---|---|---|
committer | Anthon van der Neut <anthon@mnt.org> | 2018-11-26 09:24:31 +0100 |
commit | 10438bc786dc6a381193025779cf86e072a1108a (patch) | |
tree | 19880df160235f35b4e3443509a77e84bd560870 /representer.py | |
parent | fa720ebff5f3ee49cb70d3741d07e1f3fd957a62 (diff) | |
download | ruamel.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 'representer.py')
-rw-r--r-- | representer.py | 6 |
1 files changed, 5 insertions, 1 deletions
diff --git a/representer.py b/representer.py index 143b7d5..7ce810e 100644 --- a/representer.py +++ b/representer.py @@ -691,7 +691,11 @@ class RoundTripRepresenter(SafeRepresenter): tag = None style = '>' for fold_pos in reversed(getattr(data, 'fold_pos', [])): - if data[fold_pos] == ' ': + if ( + data[fold_pos] == ' ' + and (fold_pos > 0 and not data[fold_pos - 1].isspace()) + and (fold_pos < len(data) and not data[fold_pos + 1].isspace()) + ): data = data[:fold_pos] + '\a' + data[fold_pos:] if PY2 and not isinstance(data, unicode): data = unicode(data, 'ascii') |