]> git.ipfire.org Git - thirdparty/kernel/stable-queue.git/blob - queue-4.4/kconfig-mn-conf-handle-backspace-h-key.patch
4.4-stable patches
[thirdparty/kernel/stable-queue.git] / queue-4.4 / kconfig-mn-conf-handle-backspace-h-key.patch
1 From 7aff03ec481d8e686c2e8087e1ab72d39398d3f1 Mon Sep 17 00:00:00 2001
2 From: Changbin Du <changbin.du@gmail.com>
3 Date: Mon, 25 Mar 2019 15:16:47 +0000
4 Subject: kconfig/[mn]conf: handle backspace (^H) key
5
6 [ Upstream commit 9c38f1f044080392603c497ecca4d7d09876ff99 ]
7
8 Backspace is not working on some terminal emulators which do not send the
9 key code defined by terminfo. Terminals either send '^H' (8) or '^?' (127).
10 But currently only '^?' is handled. Let's also handle '^H' for those
11 terminals.
12
13 Signed-off-by: Changbin Du <changbin.du@gmail.com>
14 Signed-off-by: Masahiro Yamada <yamada.masahiro@socionext.com>
15 Signed-off-by: Sasha Levin (Microsoft) <sashal@kernel.org>
16 ---
17 scripts/kconfig/lxdialog/inputbox.c | 3 ++-
18 scripts/kconfig/nconf.c | 2 +-
19 scripts/kconfig/nconf.gui.c | 3 ++-
20 3 files changed, 5 insertions(+), 3 deletions(-)
21
22 diff --git a/scripts/kconfig/lxdialog/inputbox.c b/scripts/kconfig/lxdialog/inputbox.c
23 index d58de1dc5360..510049a7bd1d 100644
24 --- a/scripts/kconfig/lxdialog/inputbox.c
25 +++ b/scripts/kconfig/lxdialog/inputbox.c
26 @@ -126,7 +126,8 @@ int dialog_inputbox(const char *title, const char *prompt, int height, int width
27 case KEY_DOWN:
28 break;
29 case KEY_BACKSPACE:
30 - case 127:
31 + case 8: /* ^H */
32 + case 127: /* ^? */
33 if (pos) {
34 wattrset(dialog, dlg.inputbox.atr);
35 if (input_x == 0) {
36 diff --git a/scripts/kconfig/nconf.c b/scripts/kconfig/nconf.c
37 index d42d534a66cd..f7049e288e93 100644
38 --- a/scripts/kconfig/nconf.c
39 +++ b/scripts/kconfig/nconf.c
40 @@ -1046,7 +1046,7 @@ static int do_match(int key, struct match_state *state, int *ans)
41 state->match_direction = FIND_NEXT_MATCH_UP;
42 *ans = get_mext_match(state->pattern,
43 state->match_direction);
44 - } else if (key == KEY_BACKSPACE || key == 127) {
45 + } else if (key == KEY_BACKSPACE || key == 8 || key == 127) {
46 state->pattern[strlen(state->pattern)-1] = '\0';
47 adj_match_dir(&state->match_direction);
48 } else
49 diff --git a/scripts/kconfig/nconf.gui.c b/scripts/kconfig/nconf.gui.c
50 index 4b2f44c20caf..9a65035cf787 100644
51 --- a/scripts/kconfig/nconf.gui.c
52 +++ b/scripts/kconfig/nconf.gui.c
53 @@ -439,7 +439,8 @@ int dialog_inputbox(WINDOW *main_window,
54 case KEY_F(F_EXIT):
55 case KEY_F(F_BACK):
56 break;
57 - case 127:
58 + case 8: /* ^H */
59 + case 127: /* ^? */
60 case KEY_BACKSPACE:
61 if (cursor_position > 0) {
62 memmove(&result[cursor_position-1],
63 --
64 2.19.1
65