Skip to content

Commit 99b40fa

Browse files
committed
Avoid wrapping size_t to -1
1 parent 8b96e8a commit 99b40fa

1 file changed

Lines changed: 2 additions & 3 deletions

File tree

embedded_cli.c

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -85,9 +85,8 @@ static void term_cursor_fwd(struct embedded_cli *cli, size_t n)
8585
#if EMBEDDED_CLI_HISTORY_LEN
8686
static void term_backspace(struct embedded_cli *cli, size_t n)
8787
{
88-
// printf("backspace %d ('%s': %d)\n", n, cli->buffer, cli->done);
89-
while (n--)
90-
cli_putchar(cli, '\b', n == 0);
88+
for (; n > 0; n--)
89+
cli_putchar(cli, '\b', n == 1);
9190
}
9291

9392
static const char *embedded_cli_get_history_search(struct embedded_cli *cli)

0 commit comments

Comments
 (0)