Skip to content

Commit b0f8ef9

Browse files
committed
Shell: Remove unnecessary new lines at startup
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 <theo.battrel@nordicsemi.no>
1 parent afd8a8e commit b0f8ef9

File tree

1 file changed

+4
-3
lines changed

1 file changed

+4
-3
lines changed

subsys/shell/shell.c

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1446,9 +1446,10 @@ int shell_start(const struct shell *sh)
14461446
z_shell_vt100_color_set(sh, SHELL_NORMAL);
14471447
}
14481448

1449-
if (z_shell_strlen(sh->default_prompt) > 0) {
1450-
z_shell_raw_fprintf(sh->fprintf_ctx, "\n\n");
1451-
}
1449+
/* print new line before printing the prompt to clear the line
1450+
* vt100 are not used here for compatibility reasons
1451+
*/
1452+
z_cursor_next_line_move(sh);
14521453
state_set(sh, SHELL_STATE_ACTIVE);
14531454

14541455
k_mutex_unlock(&sh->ctx->wr_mtx);

0 commit comments

Comments
 (0)