Fix clear_line and print_line to untaint line status

This commit is contained in:
yabu76 2025-12-30 12:07:43 +09:00
parent 266338a926
commit b5656112d7
2 changed files with 4 additions and 4 deletions

View file

@ -256,5 +256,5 @@ int execute_shell_command(int fd, const char *command)
void clear_line() void clear_line()
{ {
print("\r\033[K"); printf("\r\033[K");
} }

View file

@ -42,11 +42,11 @@ typedef struct readline_s
void print_line(readline_t *rl) void print_line(readline_t *rl)
{ {
clear_line(); clear_line();
print("%s%s", rl->prompt, rl->line); printf("%s%s", rl->prompt, rl->line);
print("\r"); // Move the cursor back to the beginning printf("\r"); // Move the cursor back to the beginning
for (int i = 0; i < rl->prompt_length + rl->cursor_pos; ++i) for (int i = 0; i < rl->prompt_length + rl->cursor_pos; ++i)
{ {
print("\x1b[C"); // Move the cursor right printf("\x1b[C"); // Move the cursor right
} }
} }