All of lore.kernel.org
 help / color / mirror / Atom feed
* [Qemu-devel] [PATCH] readline: Clear screen on form feed.
@ 2014-06-01 11:53 Hani Benhabiles
  2014-06-02 12:20 ` Stefan Hajnoczi
                   ` (3 more replies)
  0 siblings, 4 replies; 7+ messages in thread
From: Hani Benhabiles @ 2014-06-01 11:53 UTC (permalink / raw)
  To: qemu-devel; +Cc: kwolf, qemu-trivial, lcapitulino, stefanha, xiawenc

Signed-off-by: Hani Benhabiles <hani@linux.com>
---
 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");
+    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';
-- 
1.8.3.2

^ permalink raw reply related	[flat|nested] 7+ messages in thread

* Re: [Qemu-devel] [PATCH] readline: Clear screen on form feed.
  2014-06-01 11:53 [Qemu-devel] [PATCH] readline: Clear screen on form feed Hani Benhabiles
@ 2014-06-02 12:20 ` Stefan Hajnoczi
  2014-06-02 21:49   ` Hani Benhabiles
  2014-06-08 14:03 ` [Qemu-devel] [Qemu-trivial] " Michael Tokarev
                   ` (2 subsequent siblings)
  3 siblings, 1 reply; 7+ messages in thread
From: Stefan Hajnoczi @ 2014-06-02 12:20 UTC (permalink / raw)
  To: Hani Benhabiles
  Cc: kwolf, qemu-trivial, qemu-devel, lcapitulino, stefanha, xiawenc

On Sun, Jun 01, 2014 at 12:53:35PM +0100, Hani Benhabiles wrote:
> Signed-off-by: Hani Benhabiles <hani@linux.com>
> ---
>  util/readline.c | 9 +++++++++
>  1 file changed, 9 insertions(+)

Please only CC me on patches for areas of the code that I maintain or
you feel I am an expert in.  That includes block, net, and tracing.
Monitor and terminal escape sequences isn't my forte :-).

Stefan

^ permalink raw reply	[flat|nested] 7+ messages in thread

* Re: [Qemu-devel] [PATCH] readline: Clear screen on form feed.
  2014-06-02 12:20 ` Stefan Hajnoczi
@ 2014-06-02 21:49   ` Hani Benhabiles
  0 siblings, 0 replies; 7+ messages in thread
From: Hani Benhabiles @ 2014-06-02 21:49 UTC (permalink / raw)
  To: Stefan Hajnoczi
  Cc: kwolf, qemu-trivial, qemu-devel, lcapitulino, stefanha, xiawenc

On Mon, Jun 02, 2014 at 02:20:36PM +0200, Stefan Hajnoczi wrote:
> On Sun, Jun 01, 2014 at 12:53:35PM +0100, Hani Benhabiles wrote:
> > Signed-off-by: Hani Benhabiles <hani@linux.com>
> > ---
> >  util/readline.c | 9 +++++++++
> >  1 file changed, 9 insertions(+)
> 
> Please only CC me on patches for areas of the code that I maintain or
> you feel I am an expert in.  That includes block, net, and tracing.
> Monitor and terminal escape sequences isn't my forte :-).

Sure, np. Just used get_maintainer.pl output.

^ permalink raw reply	[flat|nested] 7+ messages in thread

* Re: [Qemu-devel] [Qemu-trivial] [PATCH] readline: Clear screen on form feed.
  2014-06-01 11:53 [Qemu-devel] [PATCH] readline: Clear screen on form feed Hani Benhabiles
  2014-06-02 12:20 ` Stefan Hajnoczi
@ 2014-06-08 14:03 ` Michael Tokarev
  2014-06-09 20:32 ` [Qemu-devel] " Luiz Capitulino
  2014-06-10 13:40 ` Luiz Capitulino
  3 siblings, 0 replies; 7+ messages in thread
From: Michael Tokarev @ 2014-06-08 14:03 UTC (permalink / raw)
  To: Hani Benhabiles, qemu-devel; +Cc: qemu-trivial

01.06.2014 15:53, Hani Benhabiles wrote:
> Signed-off-by: Hani Benhabiles <hani@linux.com>
> ---
>  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");
> +    readline_show_prompt(rs);

That's not entirely universal escape sequence, but readline
code uses similar sequences in other places already.

Applying to -trivial, thank you!

/mjt

^ permalink raw reply	[flat|nested] 7+ messages in thread

* Re: [Qemu-devel] [PATCH] readline: Clear screen on form feed.
  2014-06-01 11:53 [Qemu-devel] [PATCH] readline: Clear screen on form feed Hani Benhabiles
  2014-06-02 12:20 ` Stefan Hajnoczi
  2014-06-08 14:03 ` [Qemu-devel] [Qemu-trivial] " Michael Tokarev
@ 2014-06-09 20:32 ` Luiz Capitulino
  2014-06-09 23:00   ` Hani Benhabiles
  2014-06-10 13:40 ` Luiz Capitulino
  3 siblings, 1 reply; 7+ messages in thread
From: Luiz Capitulino @ 2014-06-09 20:32 UTC (permalink / raw)
  To: Hani Benhabiles
  Cc: kwolf, qemu-trivial, qemu-devel, Markus Armbruster, stefanha, xiawenc

On Sun,  1 Jun 2014 12:53:35 +0100
Hani Benhabiles <kroosec@gmail.com> wrote:

> Signed-off-by: Hani Benhabiles <hani@linux.com>
> ---
>  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';

^ permalink raw reply	[flat|nested] 7+ messages in thread

* Re: [Qemu-devel] [PATCH] readline: Clear screen on form feed.
  2014-06-09 20:32 ` [Qemu-devel] " Luiz Capitulino
@ 2014-06-09 23:00   ` Hani Benhabiles
  0 siblings, 0 replies; 7+ messages in thread
From: Hani Benhabiles @ 2014-06-09 23:00 UTC (permalink / raw)
  To: Luiz Capitulino; +Cc: qemu-trivial, mjt, qemu-devel

On Mon, Jun 09, 2014 at 04:32:32PM -0400, Luiz Capitulino wrote:
> On Sun,  1 Jun 2014 12:53:35 +0100
> Hani Benhabiles <kroosec@gmail.com> wrote:
> 
> > Signed-off-by: Hani Benhabiles <hani@linux.com>
> > ---
> >  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?

Sorry, I have no experience with Windows and I can't give a definite answer about it.

But as Michael pointed out, readline is already using similar escape sequences.

> 
> > +    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';
> 

^ permalink raw reply	[flat|nested] 7+ messages in thread

* Re: [Qemu-devel] [PATCH] readline: Clear screen on form feed.
  2014-06-01 11:53 [Qemu-devel] [PATCH] readline: Clear screen on form feed Hani Benhabiles
                   ` (2 preceding siblings ...)
  2014-06-09 20:32 ` [Qemu-devel] " Luiz Capitulino
@ 2014-06-10 13:40 ` Luiz Capitulino
  3 siblings, 0 replies; 7+ messages in thread
From: Luiz Capitulino @ 2014-06-10 13:40 UTC (permalink / raw)
  To: Hani Benhabiles; +Cc: kwolf, qemu-trivial, qemu-devel, stefanha, xiawenc

On Sun,  1 Jun 2014 12:53:35 +0100
Hani Benhabiles <kroosec@gmail.com> wrote:

> Signed-off-by: Hani Benhabiles <hani@linux.com>

Applied to the qmp branch, thanks.

Btw, we don't add a period to the end of the first line in the changelog.

> ---
>  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");
> +    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';

^ permalink raw reply	[flat|nested] 7+ messages in thread

end of thread, other threads:[~2014-06-10 13:40 UTC | newest]

Thread overview: 7+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2014-06-01 11:53 [Qemu-devel] [PATCH] readline: Clear screen on form feed Hani Benhabiles
2014-06-02 12:20 ` Stefan Hajnoczi
2014-06-02 21:49   ` Hani Benhabiles
2014-06-08 14:03 ` [Qemu-devel] [Qemu-trivial] " Michael Tokarev
2014-06-09 20:32 ` [Qemu-devel] " Luiz Capitulino
2014-06-09 23:00   ` Hani Benhabiles
2014-06-10 13:40 ` Luiz Capitulino

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.