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

@ -84,6 +84,8 @@
(e.g. KDE/plasma).
* Nanosecs "overflow" when calculating timeout value for
`resize-delay-ms` option.
* Missing backslash in ST terminator in escape sequences in the
built-in terminfo (accessed via XTGETTCAP).
[1173]: https://codeberg.org/dnkl/foot/issues/1173

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')