fix bind command example given by fkr

The `fish_key_reader` program emits an example `bind` command for the sequence
of keystrokes it sees. However, if that sequence includes a space or del
character the example `bind` command includes extraneous commentary that makes
the command invalid.

Fixes #3262
This commit is contained in:
Kurtis Rader 2016-08-10 22:15:52 -07:00
parent 710addde16
commit 2dbc7ddcb8

View file

@ -124,10 +124,18 @@ static char *char_to_symbol(wchar_t wc, bool bind_friendly) {
} }
} else if (wc == ' ') { } else if (wc == ' ') {
// The "space" character. // The "space" character.
snprintf(buf, sizeof(buf), "\\x%X (aka \"space\")", wc); if (bind_friendly) {
snprintf(buf, sizeof(buf), "\\x%X", wc);
} else {
snprintf(buf, sizeof(buf), "\\x%X (aka \"space\")", wc);
}
} else if (wc == 0x7F) { } else if (wc == 0x7F) {
// The "del" character. // The "del" character.
snprintf(buf, sizeof(buf), "\\x%X (aka \"del\")", wc); if (bind_friendly) {
snprintf(buf, sizeof(buf), "\\x%X", wc);
} else {
snprintf(buf, sizeof(buf), "\\x%X (aka \"del\")", wc);
}
} else if (wc < 0x80) { } else if (wc < 0x80) {
// ASCII characters that are not control characters. // ASCII characters that are not control characters.
if (bind_friendly && must_escape(wc)) { if (bind_friendly && must_escape(wc)) {