Skip to content

Commit

Permalink
readline: Clear screen on form feed.
Browse files Browse the repository at this point in the history
Signed-off-by: Hani Benhabiles <hani@linux.com>
Signed-off-by: Luiz Capitulino <lcapitulino@redhat.com>
  • Loading branch information
kroosec authored and Luiz Capitulino committed Jun 11, 2014
1 parent b21631f commit 075ccb6
Showing 1 changed file with 9 additions and 0 deletions.
9 changes: 9 additions & 0 deletions util/readline.c
Expand Up @@ -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)
{
Expand All @@ -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';
Expand Down

0 comments on commit 075ccb6

Please sign in to comment.