From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from eggs.gnu.org ([2001:4830:134:3::10]:42691) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1Wu8YC-00075k-TY for qemu-devel@nongnu.org; Mon, 09 Jun 2014 19:00:31 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1Wu8Y6-0005nd-Vs for qemu-devel@nongnu.org; Mon, 09 Jun 2014 19:00:24 -0400 Date: Tue, 10 Jun 2014 00:00:10 +0100 From: Hani Benhabiles Message-ID: <20140609230010.GA22765@Inspiron-3521> References: <1401623615-7548-1-git-send-email-kroosec@gmail.com> <20140609163232.5d0fc6ed@redhat.com> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <20140609163232.5d0fc6ed@redhat.com> Subject: Re: [Qemu-devel] [PATCH] readline: Clear screen on form feed. List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , To: Luiz Capitulino Cc: qemu-trivial@nongnu.org, mjt@tls.msk.ru, qemu-devel@nongnu.org On Mon, Jun 09, 2014 at 04:32:32PM -0400, Luiz Capitulino wrote: > On Sun, 1 Jun 2014 12:53:35 +0100 > Hani Benhabiles wrote: > > > Signed-off-by: Hani Benhabiles > > --- > > 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'; >