mirror of
https://github.com/tio/tio.git
synced 2026-05-01 14:57:59 +02:00
Fix clear_line and print_line to untaint line status
This commit is contained in:
parent
266338a926
commit
b5656112d7
2 changed files with 4 additions and 4 deletions
|
|
@ -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");
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -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
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue