Fix NormalizedString serialization splitting within escape sequences.

Resolves #1589
This commit is contained in:
Val Lorentz 2024-08-25 10:20:16 +02:00 committed by GitHub
parent b075a94396
commit 603cb600aa
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194

View File

@ -737,7 +737,10 @@ class NormalizedString(String):
def serialize(self):
s = self.__parent.serialize()
prefixLen = len(self._name) + 2
lines = textwrap.wrap(s, width=76-prefixLen)
# break_long_words=False so we don't split in the middle of a
# unicode_escape sequence when there are multiple escape sequences in a
# row.
lines = textwrap.wrap(s, width=76-prefixLen, break_long_words=False)
last = len(lines)-1
for (i, line) in enumerate(lines):
if i != 0: