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