From 2dbc7ddcb8a9fdb526a1ceec231012e0f87fc51d Mon Sep 17 00:00:00 2001 From: Kurtis Rader Date: Wed, 10 Aug 2016 22:15:52 -0700 Subject: [PATCH] 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 --- src/fish_key_reader.cpp | 12 ++++++++++-- 1 file changed, 10 insertions(+), 2 deletions(-) diff --git a/src/fish_key_reader.cpp b/src/fish_key_reader.cpp index bab8524a3..a9bf0ceef 100644 --- a/src/fish_key_reader.cpp +++ b/src/fish_key_reader.cpp @@ -124,10 +124,18 @@ static char *char_to_symbol(wchar_t wc, bool bind_friendly) { } } else if (wc == ' ') { // 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) { // 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) { // ASCII characters that are not control characters. if (bind_friendly && must_escape(wc)) {