From fd743b51736e99a097063c1f52c242e5592c298e Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Daniel=20Ekl=C3=B6f?= Date: Tue, 27 Sep 2022 19:05:56 +0200 Subject: [PATCH] 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. --- CHANGELOG.md | 2 ++ scripts/generate-builtin-terminfo.py | 4 ++++ 2 files changed, 6 insertions(+) diff --git a/CHANGELOG.md b/CHANGELOG.md index 52d5b7be..1606f3b4 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -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 diff --git a/scripts/generate-builtin-terminfo.py b/scripts/generate-builtin-terminfo.py index 906e2be0..035fa1cc 100755 --- a/scripts/generate-builtin-terminfo.py +++ b/scripts/generate-builtin-terminfo.py @@ -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')