From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from eggs.gnu.org ([2001:4830:134:3::10]:44891) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1Wujs9-0005q4-E5 for qemu-devel@nongnu.org; Wed, 11 Jun 2014 10:51:37 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1Wujs1-0008Ap-M2 for qemu-devel@nongnu.org; Wed, 11 Jun 2014 10:51:29 -0400 Received: from mx1.redhat.com ([209.132.183.28]:18722) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1Wujs1-0008A3-Ei for qemu-devel@nongnu.org; Wed, 11 Jun 2014 10:51:21 -0400 From: Luiz Capitulino Date: Wed, 11 Jun 2014 10:51:01 -0400 Message-Id: <1402498262-20521-17-git-send-email-lcapitulino@redhat.com> In-Reply-To: <1402498262-20521-1-git-send-email-lcapitulino@redhat.com> References: <1402498262-20521-1-git-send-email-lcapitulino@redhat.com> Subject: [Qemu-devel] [PULL 16/17] readline: Clear screen on form feed. List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , To: peter.maydell@linaro.org Cc: qemu-devel@nongnu.org, anthony@codemonkey.ws From: Hani Benhabiles Signed-off-by: Hani Benhabiles Signed-off-by: Luiz Capitulino --- util/readline.c | 9 +++++++++ 1 file changed, 9 insertions(+) diff --git a/util/readline.c b/util/readline.c index 7214e84..cc1302a 100644 --- a/util/readline.c +++ b/util/readline.c @@ -351,6 +351,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) { @@ -369,6 +375,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.9.3