aboutsummaryrefslogtreecommitdiff
path: root/util/readline.c
diff options
context:
space:
mode:
authorHani Benhabiles <kroosec@gmail.com>2014-06-01 12:53:35 +0100
committerLuiz Capitulino <lcapitulino@redhat.com>2014-06-11 10:10:29 -0400
commit075ccb6cd3f7abe648a3e708ed34cfced378647f (patch)
tree93fef99dca5bedc8d4aed40a7d9ff30ecb18f049 /util/readline.c
parentb21631f3b5cdecd14114034cd9e4e7f63ed7fde1 (diff)
readline: Clear screen on form feed.
Signed-off-by: Hani Benhabiles <hani@linux.com> Signed-off-by: Luiz Capitulino <lcapitulino@redhat.com>
Diffstat (limited to 'util/readline.c')
-rw-r--r--util/readline.c9
1 files changed, 9 insertions, 0 deletions
diff --git a/util/readline.c b/util/readline.c
index 7214e8407c..cc1302ac0a 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';