From 9aba9ddd0cf76b06e234005ed728c4273b4ad8ab Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Th=C3=A9o=20Battrel?= Date: Tue, 20 Aug 2024 14:09:56 +0200 Subject: [PATCH] Shell: Remove unnecessary new lines at startup MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit When the shell start, it will print two lines. The reason for that behavior is not documented. Remove that to make the code simpler and shorter one line at a time. Signed-off-by: Théo Battrel --- subsys/shell/shell.c | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) diff --git a/subsys/shell/shell.c b/subsys/shell/shell.c index 37005b38c1d..9d3a5dd208a 100644 --- a/subsys/shell/shell.c +++ b/subsys/shell/shell.c @@ -1446,9 +1446,10 @@ int shell_start(const struct shell *sh) z_shell_vt100_color_set(sh, SHELL_NORMAL); } - if (z_shell_strlen(sh->default_prompt) > 0) { - z_shell_raw_fprintf(sh->fprintf_ctx, "\n\n"); - } + /* print new line before printing the prompt to clear the line + * vt100 are not used here for compatibility reasons + */ + z_cursor_next_line_move(sh); state_set(sh, SHELL_STATE_ACTIVE); k_mutex_unlock(&sh->ctx->wr_mtx);