diff --git a/subsys/shell/shell_ops.c b/subsys/shell/shell_ops.c index 30b58abf717..d8dae42c055 100644 --- a/subsys/shell/shell_ops.c +++ b/subsys/shell/shell_ops.c @@ -50,8 +50,10 @@ static inline bool full_line_cmd(const struct shell *shell) /* Function returns true if cursor is at beginning of an empty line. */ bool z_shell_cursor_in_empty_line(const struct shell *shell) { - return ((shell->ctx->cmd_buff_pos + z_shell_strlen(shell->ctx->prompt)) - % shell->ctx->vt100_ctx.cons.terminal_wid == 0U); + return (((shell->ctx->cmd_buff_pos * shell->ctx->cfg.flags.echo) + + z_shell_strlen(shell->ctx->prompt)) % + shell->ctx->vt100_ctx.cons.terminal_wid == + 0U); } void z_shell_op_cond_next_line(const struct shell *shell)