diff --git a/subsys/shell/Kconfig b/subsys/shell/Kconfig index 5f6bbcee33f..c4a586e990a 100644 --- a/subsys/shell/Kconfig +++ b/subsys/shell/Kconfig @@ -88,8 +88,9 @@ config SHELL_METAKEYS bool "Enable metakeys" default y help - Enables shell metakeys: Home, End, ctrl+a, ctrl+c, ctrl+e, ctrl+l, - ctrl+u, ctrl+w + Enables shell meta keys: Ctrl+a, Ctrl+b, Ctrl+c, Ctrl+d, Ctrl+e, + Ctrl+f, Ctrl+k, Ctrl+l, Ctrl+u, Ctrl+w, Alt+b, Alt+f + Meta keys will not be active when shell echo is set to off. config SHELL_HELP bool "Enable help message" diff --git a/subsys/shell/shell.c b/subsys/shell/shell.c index c11a52985c5..739ead70fc8 100644 --- a/subsys/shell/shell.c +++ b/subsys/shell/shell.c @@ -949,7 +949,7 @@ static void state_collect(const struct shell *shell) if (isprint((int) data)) { flag_history_exit_set(shell, true); shell_op_char_insert(shell, data); - } else { + } else if (flag_echo_get(shell)) { ctrl_metakeys_handle(shell, data); } break; @@ -960,11 +960,11 @@ static void state_collect(const struct shell *shell) if (data == '[') { receive_state_change(shell, SHELL_RECEIVE_ESC_SEQ); - } else { + break; + } else if (flag_echo_get(shell)) { alt_metakeys_handle(shell, data); - receive_state_change(shell, - SHELL_RECEIVE_DEFAULT); } + receive_state_change(shell, SHELL_RECEIVE_DEFAULT); break; case SHELL_RECEIVE_ESC_SEQ: diff --git a/subsys/shell/shell_ops.c b/subsys/shell/shell_ops.c index 3aaadc3bf2f..7bb28634bcc 100644 --- a/subsys/shell/shell_ops.c +++ b/subsys/shell/shell_ops.c @@ -261,6 +261,11 @@ static void data_insert(const struct shell *shell, const char *data, u16_t len) void char_replace(const struct shell *shell, char data) { shell->ctx->cmd_buff[shell->ctx->cmd_buff_pos++] = data; + + if (!flag_echo_get(shell)) { + return; + } + shell_raw_fprintf(shell->fprintf_ctx, "%c", data); if (shell_cursor_in_empty_line(shell)) { cursor_next_line_move(shell);