scripts: generate-builtin-terminfo: double-escape backslash in ST

Fixes an issue with XTGETTCAP, where escape sequences terminated with
ST, and containing parameters were missing a trailing backslash.
This commit is contained in:
Daniel Eklöf 2022-09-27 19:05:56 +02:00
parent 37218be648
commit fd743b5173
No known key found for this signature in database
GPG key ID: 5BBD4992C116573F
2 changed files with 6 additions and 0 deletions

View file

@ -55,6 +55,10 @@ class StringCapability(Capability):
value = re.sub(r'\\E([0-7])', r'\\033" "\1', value)
value = re.sub(r'\\E', r'\\033', value)
else:
# Need to double-escape backslashes. These only occur in
# \E\ combos. Note that \E itself is updated below
value = value.replace('\\E\\\\', '\\E\\\\\\\\')
# Need to double-escape \E in C string literals
value = value.replace('\\E', '\\\\E')