Donate to e Foundation | Murena handsets with /e/OS | Own a part of Murena! Learn more

Commit 13103fc1 authored by Changbin Du's avatar Changbin Du Committed by Greg Kroah-Hartman
Browse files

kconfig/[mn]conf: handle backspace (^H) key



[ Upstream commit 9c38f1f044080392603c497ecca4d7d09876ff99 ]

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: default avatarChangbin Du <changbin.du@gmail.com>
Signed-off-by: default avatarMasahiro Yamada <yamada.masahiro@socionext.com>
Signed-off-by: default avatarSasha Levin (Microsoft) <sashal@kernel.org>
parent 9b972025
Loading
Loading
Loading
Loading
+2 −1
Original line number Diff line number Diff line
@@ -126,7 +126,8 @@ int dialog_inputbox(const char *title, const char *prompt, int height, int width
			case KEY_DOWN:
				break;
			case KEY_BACKSPACE:
			case 127:
			case 8:   /* ^H */
			case 127: /* ^? */
				if (pos) {
					wattrset(dialog, dlg.inputbox.atr);
					if (input_x == 0) {
+1 −1
Original line number Diff line number Diff line
@@ -1046,7 +1046,7 @@ static int do_match(int key, struct match_state *state, int *ans)
		state->match_direction = FIND_NEXT_MATCH_UP;
		*ans = get_mext_match(state->pattern,
				state->match_direction);
	} else if (key == KEY_BACKSPACE || key == 127) {
	} else if (key == KEY_BACKSPACE || key == 8 || key == 127) {
		state->pattern[strlen(state->pattern)-1] = '\0';
		adj_match_dir(&state->match_direction);
	} else
+2 −1
Original line number Diff line number Diff line
@@ -439,7 +439,8 @@ int dialog_inputbox(WINDOW *main_window,
		case KEY_F(F_EXIT):
		case KEY_F(F_BACK):
			break;
		case 127:
		case 8:   /* ^H */
		case 127: /* ^? */
		case KEY_BACKSPACE:
			if (cursor_position > 0) {
				memmove(&result[cursor_position-1],