Skip to content

Commit 9c38f1f

Browse files
changbindumasahir0y
authored andcommitted
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>
1 parent 54a7151 commit 9c38f1f

File tree

3 files changed

+5
-3
lines changed

3 files changed

+5
-3
lines changed

scripts/kconfig/lxdialog/inputbox.c

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -113,7 +113,8 @@ int dialog_inputbox(const char *title, const char *prompt, int height, int width
113113
case KEY_DOWN:
114114
break;
115115
case KEY_BACKSPACE:
116-
case 127:
116+
case 8: /* ^H */
117+
case 127: /* ^? */
117118
if (pos) {
118119
wattrset(dialog, dlg.inputbox.atr);
119120
if (input_x == 0) {

scripts/kconfig/nconf.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1048,7 +1048,7 @@ static int do_match(int key, struct match_state *state, int *ans)
10481048
state->match_direction = FIND_NEXT_MATCH_UP;
10491049
*ans = get_mext_match(state->pattern,
10501050
state->match_direction);
1051-
} else if (key == KEY_BACKSPACE || key == 127) {
1051+
} else if (key == KEY_BACKSPACE || key == 8 || key == 127) {
10521052
state->pattern[strlen(state->pattern)-1] = '\0';
10531053
adj_match_dir(&state->match_direction);
10541054
} else

scripts/kconfig/nconf.gui.c

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -439,7 +439,8 @@ int dialog_inputbox(WINDOW *main_window,
439439
case KEY_F(F_EXIT):
440440
case KEY_F(F_BACK):
441441
break;
442-
case 127:
442+
case 8: /* ^H */
443+
case 127: /* ^? */
443444
case KEY_BACKSPACE:
444445
if (cursor_position > 0) {
445446
memmove(&result[cursor_position-1],

0 commit comments

Comments
 (0)