[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: [Qemu-devel] [PATCH] readline: Clear screen on form feed.
From: |
Luiz Capitulino |
Subject: |
Re: [Qemu-devel] [PATCH] readline: Clear screen on form feed. |
Date: |
Mon, 9 Jun 2014 16:32:32 -0400 |
On Sun, 1 Jun 2014 12:53:35 +0100
Hani Benhabiles <address@hidden> wrote:
> Signed-off-by: Hani Benhabiles <address@hidden>
> ---
> util/readline.c | 9 +++++++++
> 1 file changed, 9 insertions(+)
>
> diff --git a/util/readline.c b/util/readline.c
> index 8baec55..08d07e3 100644
> --- a/util/readline.c
> +++ b/util/readline.c
> @@ -345,6 +345,12 @@ static void readline_completion(ReadLineState *rs)
> }
> }
>
> +static void readline_clear_screen(ReadLineState *rs)
> +{
> + rs->printf_func(rs->opaque, "\033[2J\033[1;1H");
That's a smart way of doing it and I can't suggest anything better. But
what happens on Windows?
> + readline_show_prompt(rs);
> +}
> +
> /* return true if command handled */
> void readline_handle_byte(ReadLineState *rs, int ch)
> {
> @@ -363,6 +369,9 @@ void readline_handle_byte(ReadLineState *rs, int ch)
> case 9:
> readline_completion(rs);
> break;
> + case 12:
> + readline_clear_screen(rs);
> + break;
> case 10:
> case 13:
> rs->cmd_buf[rs->cmd_buf_size] = '\0';