Shell: Make full_line_cmd
return false on empty lines
The fact that the function was returning `true` for empty line was an unexpected behavior according to the name of the function itself and how it was used elsewhere. Signed-off-by: Théo Battrel <theo.battrel@nordicsemi.no>
This commit is contained in:
parent
e2b34b96e3
commit
e34542a3de
1 changed files with 7 additions and 2 deletions
|
@ -43,8 +43,13 @@ void z_shell_op_cursor_horiz_move(const struct shell *sh, int32_t delta)
|
||||||
*/
|
*/
|
||||||
static inline bool full_line_cmd(const struct shell *sh)
|
static inline bool full_line_cmd(const struct shell *sh)
|
||||||
{
|
{
|
||||||
return ((sh->ctx->cmd_buff_len + z_shell_strlen(sh->ctx->prompt))
|
size_t line_length = sh->ctx->cmd_buff_len + z_shell_strlen(sh->ctx->prompt);
|
||||||
% sh->ctx->vt100_ctx.cons.terminal_wid == 0U);
|
|
||||||
|
if (line_length == 0) {
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
|
||||||
|
return (line_length % sh->ctx->vt100_ctx.cons.terminal_wid == 0U);
|
||||||
}
|
}
|
||||||
|
|
||||||
/* Function returns true if cursor is at beginning of an empty line. */
|
/* Function returns true if cursor is at beginning of an empty line. */
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue