qemu-devel.nongnu.org archive mirror
 help / color / mirror / Atom feed
* [Qemu-devel] [PATCH for-1.5] readline: Handle xterm escape sequences for Home/End keys
@ 2013-05-14 10:15 Kevin Wolf
  2013-05-14 10:26 ` Hans de Goede
  2013-05-14 16:10 ` Anthony Liguori
  0 siblings, 2 replies; 3+ messages in thread
From: Kevin Wolf @ 2013-05-14 10:15 UTC (permalink / raw)
  To: anthony; +Cc: kwolf, qemu-devel

This fixes the Home/End keys in the monitor using the GTK frontend.

Signed-off-by: Kevin Wolf <kwolf@redhat.com>
---
 readline.c | 15 +++++++++++++++
 1 file changed, 15 insertions(+)

diff --git a/readline.c b/readline.c
index d6e04d4..1c0f7ee 100644
--- a/readline.c
+++ b/readline.c
@@ -27,6 +27,7 @@
 #define IS_NORM 0
 #define IS_ESC  1
 #define IS_CSI  2
+#define IS_SS3  3
 
 #undef printf
 #define printf do_not_use_printf
@@ -397,6 +398,9 @@ void readline_handle_byte(ReadLineState *rs, int ch)
         if (ch == '[') {
             rs->esc_state = IS_CSI;
             rs->esc_param = 0;
+        } else if (ch == 'O') {
+            rs->esc_state = IS_SS3;
+            rs->esc_param = 0;
         } else {
             rs->esc_state = IS_NORM;
         }
@@ -439,6 +443,17 @@ void readline_handle_byte(ReadLineState *rs, int ch)
         rs->esc_state = IS_NORM;
     the_end:
         break;
+    case IS_SS3:
+        switch(ch) {
+        case 'F':
+            readline_eol(rs);
+            break;
+        case 'H':
+            readline_bol(rs);
+            break;
+        }
+        rs->esc_state = IS_NORM;
+        break;
     }
     readline_update(rs);
 }
-- 
1.8.1.4

^ permalink raw reply related	[flat|nested] 3+ messages in thread

end of thread, other threads:[~2013-05-14 16:11 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2013-05-14 10:15 [Qemu-devel] [PATCH for-1.5] readline: Handle xterm escape sequences for Home/End keys Kevin Wolf
2013-05-14 10:26 ` Hans de Goede
2013-05-14 16:10 ` Anthony Liguori

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).