escape_string_script: Escape DEL as \x7f

This used to print a literal DEL character in the output for `bind`,
which wouldn't actually show up and made it hard to figure out what
the key was.

So we just escape it back to how we actually used it - `\x7f`.

Fixes #7631.
This commit is contained in:
Fabian Homborg 2021-01-16 12:49:49 +01:00
parent a4f5dd5054
commit 932074f06c
2 changed files with 11 additions and 0 deletions

View File

@ -953,6 +953,14 @@ static void escape_string_script(const wchar_t *orig_in, size_t in_len, wcstring
need_escape = need_complex_escape = true;
break;
}
case L'\x7F': {
out += L'\\';
out += L'x';
out += L'7';
out += L'f';
need_escape = need_complex_escape = true;
break;
}
case L'\\':
case L'\'': {
need_escape = need_complex_escape = true;

View File

@ -710,3 +710,6 @@ end
# CHECKERR: checks/string.fish (line {{\d+}}): function: The name 'string' is reserved, and cannot be used as a function name
# CHECKERR: function string
# CHECKERR: ^
string escape \x7F
# CHECK: \x7f