提交 075ccb6c 编写于 作者: H Hani Benhabiles 提交者: Luiz Capitulino

readline: Clear screen on form feed.

Signed-off-by: NHani Benhabiles <hani@linux.com>
Signed-off-by: NLuiz Capitulino <lcapitulino@redhat.com>
上级 b21631f3
...@@ -351,6 +351,12 @@ static void readline_completion(ReadLineState *rs) ...@@ -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 */ /* return true if command handled */
void readline_handle_byte(ReadLineState *rs, int ch) void readline_handle_byte(ReadLineState *rs, int ch)
{ {
...@@ -369,6 +375,9 @@ void readline_handle_byte(ReadLineState *rs, int ch) ...@@ -369,6 +375,9 @@ void readline_handle_byte(ReadLineState *rs, int ch)
case 9: case 9:
readline_completion(rs); readline_completion(rs);
break; break;
case 12:
readline_clear_screen(rs);
break;
case 10: case 10:
case 13: case 13:
rs->cmd_buf[rs->cmd_buf_size] = '\0'; rs->cmd_buf[rs->cmd_buf_size] = '\0';
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册