]> Git Repo - qemu.git/blobdiff - util/readline.c
Merge remote-tracking branch 'remotes/ericb/tags/pull-nbd-2017-11-28' into staging
[qemu.git] / util / readline.c
index 7214e8407c0f17421431a381f12872569a0aa2b6..bbdee790b02517cbf6008ca2c0006c016c2ce896 100644 (file)
  * THE SOFTWARE.
  */
 
+#include "qemu/osdep.h"
 #include "qemu-common.h"
 #include "qemu/readline.h"
+#include "qemu/cutils.h"
 
 #define IS_NORM 0
 #define IS_ESC  1
@@ -351,6 +353,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 +377,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';
This page took 0.023615 seconds and 4 git commands to generate.