23-kconfig-mn-conf-handle-backspace-H-key.patch 2.1 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162
  1. From 9c38f1f044080392603c497ecca4d7d09876ff99 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: [PATCH 23/23] kconfig/[mn]conf: handle backspace (^H) key
  5. Backspace is not working on some terminal emulators which do not send the
  6. key code defined by terminfo. Terminals either send '^H' (8) or '^?' (127).
  7. But currently only '^?' is handled. Let's also handle '^H' for those
  8. terminals.
  9. Signed-off-by: Changbin Du <changbin.du@gmail.com>
  10. Signed-off-by: Masahiro Yamada <yamada.masahiro@socionext.com>
  11. ---
  12. kconfig/lxdialog/inputbox.c | 3 ++-
  13. kconfig/nconf.c | 2 +-
  14. kconfig/nconf.gui.c | 3 ++-
  15. 3 files changed, 5 insertions(+), 3 deletions(-)
  16. diff --git a/kconfig/lxdialog/inputbox.c b/kconfig/lxdialog/inputbox.c
  17. index 611945611bf8..1dcfb288ee63 100644
  18. --- a/kconfig/lxdialog/inputbox.c
  19. +++ b/kconfig/lxdialog/inputbox.c
  20. @@ -113,7 +113,8 @@ int dialog_inputbox(const char *title, const char *prompt, int height, int width
  21. case KEY_DOWN:
  22. break;
  23. case KEY_BACKSPACE:
  24. - case 127:
  25. + case 8: /* ^H */
  26. + case 127: /* ^? */
  27. if (pos) {
  28. wattrset(dialog, dlg.inputbox.atr);
  29. if (input_x == 0) {
  30. diff --git a/kconfig/nconf.c b/kconfig/nconf.c
  31. index a4670f4e825a..ac92c0ded6c5 100644
  32. --- a/kconfig/nconf.c
  33. +++ b/kconfig/nconf.c
  34. @@ -1048,7 +1048,7 @@ static int do_match(int key, struct match_state *state, int *ans)
  35. state->match_direction = FIND_NEXT_MATCH_UP;
  36. *ans = get_mext_match(state->pattern,
  37. state->match_direction);
  38. - } else if (key == KEY_BACKSPACE || key == 127) {
  39. + } else if (key == KEY_BACKSPACE || key == 8 || key == 127) {
  40. state->pattern[strlen(state->pattern)-1] = '\0';
  41. adj_match_dir(&state->match_direction);
  42. } else
  43. diff --git a/kconfig/nconf.gui.c b/kconfig/nconf.gui.c
  44. index 7be620a1fcdb..77f525a8617c 100644
  45. --- a/kconfig/nconf.gui.c
  46. +++ b/kconfig/nconf.gui.c
  47. @@ -439,7 +439,8 @@ int dialog_inputbox(WINDOW *main_window,
  48. case KEY_F(F_EXIT):
  49. case KEY_F(F_BACK):
  50. break;
  51. - case 127:
  52. + case 8: /* ^H */
  53. + case 127: /* ^? */
  54. case KEY_BACKSPACE:
  55. if (cursor_position > 0) {
  56. memmove(&result[cursor_position-1],
  57. --
  58. 2.48.1