aboutsummaryrefslogtreecommitdiff
path: root/scripts
diff options
context:
space:
mode:
Diffstat (limited to 'scripts')
-rwxr-xr-xscripts/generate-builtin-terminfo.py6
1 files changed, 3 insertions, 3 deletions
diff --git a/scripts/generate-builtin-terminfo.py b/scripts/generate-builtin-terminfo.py
index 61bd4a3c..4bb16359 100755
--- a/scripts/generate-builtin-terminfo.py
+++ b/scripts/generate-builtin-terminfo.py
@@ -56,9 +56,9 @@ class StringCapability(Capability):
def translate_ctrl_chr(m):
ctrl = m.group(1)
if ctrl == '?':
- return chr(0x7f)
- return chr(ord(ctrl) - ord('@'))
- value = re.sub('\^([@A-Z[\\\\\]^_?])', translate_ctrl_chr, value)
+ return '\\x7f'
+ return f'\\x{ord(ctrl) - ord('@'):02x}'
+ value = re.sub(r'\^([@A-Z[\\\\\]^_?])', translate_ctrl_chr, value)
# Ensure e.g. \E7 (or \e7) doesn’t get translated to “\0337”,
# which would be interpreted as octal 337 by the C compiler