aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorChangbin Du <changbin.du@gmail.com>2019-03-25 11:16:47 -0400
committerMasahiro Yamada <yamada.masahiro@socionext.com>2019-03-29 09:48:01 -0400
commit9c38f1f044080392603c497ecca4d7d09876ff99 (patch)
treecfccd65421505a7cabf6e3e9f13a1ed64035ecf7
parent54a7151b1496cddbb7a83546b7998103e98edc88 (diff)
kconfig/[mn]conf: handle backspace (^H) key
Backspace is not working on some terminal emulators which do not send the key code defined by terminfo. Terminals either send '^H' (8) or '^?' (127). But currently only '^?' is handled. Let's also handle '^H' for those terminals. Signed-off-by: Changbin Du <changbin.du@gmail.com> Signed-off-by: Masahiro Yamada <yamada.masahiro@socionext.com>
-rw-r--r--scripts/kconfig/lxdialog/inputbox.c3
-rw-r--r--scripts/kconfig/nconf.c2
-rw-r--r--scripts/kconfig/nconf.gui.c3
3 files changed, 5 insertions, 3 deletions
diff --git a/scripts/kconfig/lxdialog/inputbox.c b/scripts/kconfig/lxdialog/inputbox.c
index 611945611bf8..1dcfb288ee63 100644
--- a/scripts/kconfig/lxdialog/inputbox.c
+++ b/scripts/kconfig/lxdialog/inputbox.c
@@ -113,7 +113,8 @@ do_resize:
113 case KEY_DOWN: 113 case KEY_DOWN:
114 break; 114 break;
115 case KEY_BACKSPACE: 115 case KEY_BACKSPACE:
116 case 127: 116 case 8: /* ^H */
117 case 127: /* ^? */
117 if (pos) { 118 if (pos) {
118 wattrset(dialog, dlg.inputbox.atr); 119 wattrset(dialog, dlg.inputbox.atr);
119 if (input_x == 0) { 120 if (input_x == 0) {
diff --git a/scripts/kconfig/nconf.c b/scripts/kconfig/nconf.c
index a4670f4e825a..ac92c0ded6c5 100644
--- a/scripts/kconfig/nconf.c
+++ b/scripts/kconfig/nconf.c
@@ -1048,7 +1048,7 @@ static int do_match(int key, struct match_state *state, int *ans)
1048 state->match_direction = FIND_NEXT_MATCH_UP; 1048 state->match_direction = FIND_NEXT_MATCH_UP;
1049 *ans = get_mext_match(state->pattern, 1049 *ans = get_mext_match(state->pattern,
1050 state->match_direction); 1050 state->match_direction);
1051 } else if (key == KEY_BACKSPACE || key == 127) { 1051 } else if (key == KEY_BACKSPACE || key == 8 || key == 127) {
1052 state->pattern[strlen(state->pattern)-1] = '\0'; 1052 state->pattern[strlen(state->pattern)-1] = '\0';
1053 adj_match_dir(&state->match_direction); 1053 adj_match_dir(&state->match_direction);
1054 } else 1054 } else
diff --git a/scripts/kconfig/nconf.gui.c b/scripts/kconfig/nconf.gui.c
index 7be620a1fcdb..77f525a8617c 100644
--- a/scripts/kconfig/nconf.gui.c
+++ b/scripts/kconfig/nconf.gui.c
@@ -439,7 +439,8 @@ int dialog_inputbox(WINDOW *main_window,
439 case KEY_F(F_EXIT): 439 case KEY_F(F_EXIT):
440 case KEY_F(F_BACK): 440 case KEY_F(F_BACK):
441 break; 441 break;
442 case 127: 442 case 8: /* ^H */
443 case 127: /* ^? */
443 case KEY_BACKSPACE: 444 case KEY_BACKSPACE:
444 if (cursor_position > 0) { 445 if (cursor_position > 0) {
445 memmove(&result[cursor_position-1], 446 memmove(&result[cursor_position-1],