aboutsummaryrefslogtreecommitdiff
path: root/readline.c
diff options
context:
space:
mode:
authorKevin Wolf <kwolf@redhat.com>2013-05-14 12:15:54 +0200
committerAnthony Liguori <aliguori@us.ibm.com>2013-05-14 08:53:22 -0500
commitd34dc45d34618aa2495e892caba62a4aa521b386 (patch)
tree62d484fed33f5955a1654f6bde8680a84e3cc4e1 /readline.c
parent7791dba3ec10ab7daa7cfecf84c617594c9776cc (diff)
readline: Handle xterm escape sequences for Home/End keys
This fixes the Home/End keys in the monitor using the GTK frontend. Signed-off-by: Kevin Wolf <kwolf@redhat.com> Message-id: 1368526554-15866-1-git-send-email-kwolf@redhat.com Signed-off-by: Anthony Liguori <aliguori@us.ibm.com>
Diffstat (limited to 'readline.c')
-rw-r--r--readline.c15
1 files changed, 15 insertions, 0 deletions
diff --git a/readline.c b/readline.c
index d6e04d4796..1c0f7ee26b 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);
}