mirror of
https://github.com/tio/tio.git
synced 2026-05-01 14:57:59 +02:00
Keep the line input mode prompt on the local screen after input
It is for visibility. Note: This line input mode prompt is not recorded by tio's logging function.
This commit is contained in:
parent
4153a4571a
commit
d5b4e7d881
3 changed files with 13 additions and 0 deletions
|
|
@ -39,6 +39,17 @@ typedef struct readline_s
|
|||
int escape;
|
||||
} readline_t;
|
||||
|
||||
void print_prompt(readline_t *rl)
|
||||
{
|
||||
clear_line();
|
||||
printf("%s", rl->prompt);
|
||||
printf("\r"); // Move the cursor back to the beginning
|
||||
for (int i = 0; i < rl->prompt_length; ++i)
|
||||
{
|
||||
printf("\x1b[C"); // Move the cursor right
|
||||
}
|
||||
}
|
||||
|
||||
void print_line(readline_t *rl)
|
||||
{
|
||||
clear_line();
|
||||
|
|
|
|||
|
|
@ -32,3 +32,4 @@ void readline_set_prompt(readline_t *rl, const char *prompt);
|
|||
void readline_prompt_for_input(readline_t *rl);
|
||||
void readline_input(readline_t *rl, char input_char);
|
||||
char *readline_get(readline_t *rl);
|
||||
void print_prompt(readline_t *rl);
|
||||
|
|
|
|||
|
|
@ -3274,6 +3274,7 @@ int tty_connect(void)
|
|||
{
|
||||
// Carriage return
|
||||
readline_input(readline_ctx, input_char);
|
||||
print_prompt(readline_ctx);
|
||||
|
||||
// Write current line to tty device
|
||||
char *rl_line = readline_get(readline_ctx);
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue