summaryrefslogtreecommitdiff
path: root/usr.bin/tmux
diff options
context:
space:
mode:
authorNicholas Marriott <nicm@cvs.openbsd.org>2009-10-26 13:58:03 +0000
committerNicholas Marriott <nicm@cvs.openbsd.org>2009-10-26 13:58:03 +0000
commit12b68a00663beaa89ef4a757394b3926682f7dd9 (patch)
tree5c47ff63cbd3232a13aa75a436e7b1a63f553a44 /usr.bin/tmux
parent78e3a458fc168601a53b8d059b57c8e9ae2e51f1 (diff)
As we always put the cursor keys into application mode, assume keys sent
with CSI have ctrl. Also add a couple of comments.
Diffstat (limited to 'usr.bin/tmux')
-rw-r--r--usr.bin/tmux/tty-keys.c21
1 files changed, 15 insertions, 6 deletions
diff --git a/usr.bin/tmux/tty-keys.c b/usr.bin/tmux/tty-keys.c
index 44f8df9a957..e867f775a53 100644
--- a/usr.bin/tmux/tty-keys.c
+++ b/usr.bin/tmux/tty-keys.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: tty-keys.c,v 1.8 2009/10/26 13:41:46 nicm Exp $ */
+/* $OpenBSD: tty-keys.c,v 1.9 2009/10/26 13:58:02 nicm Exp $ */
/*
* Copyright (c) 2007 Nicholas Marriott <nicm@users.sourceforge.net>
@@ -25,6 +25,10 @@
#include "tmux.h"
+/*
+ * Handle keys input from the outside terminal.
+ */
+
void tty_keys_add(struct tty *, const char *, int, int);
int tty_keys_mouse(char *, size_t, size_t *, struct mouse_event *);
@@ -67,21 +71,26 @@ struct tty_key_ent tty_keys[] = {
{ TTYC_KPP, NULL, KEYC_PPAGE, TTYKEY_CTRL },
{ TTYC_KCBT, NULL, KEYC_BTAB, TTYKEY_CTRL },
- /* Arrow keys. */
+ /*
+ * Arrow keys. There are several variants of these so just accept them.
+ * We always put the terminal into application keys mode so ctrl should
+ * swap between SS3 and CSI.
+ */
{ 0, "\033OA", KEYC_UP, TTYKEY_RAW },
{ 0, "\033OB", KEYC_DOWN, TTYKEY_RAW },
{ 0, "\033OC", KEYC_RIGHT, TTYKEY_RAW },
{ 0, "\033OD", KEYC_LEFT, TTYKEY_RAW },
- { 0, "\033[A", KEYC_UP, TTYKEY_RAW },
- { 0, "\033[B", KEYC_DOWN, TTYKEY_RAW },
- { 0, "\033[C", KEYC_RIGHT, TTYKEY_RAW },
- { 0, "\033[D", KEYC_LEFT, TTYKEY_RAW },
+ { 0, "\033[A", KEYC_UP|KEYC_CTRL, TTYKEY_RAW },
+ { 0, "\033[B", KEYC_DOWN|KEYC_CTRL, TTYKEY_RAW },
+ { 0, "\033[C", KEYC_RIGHT|KEYC_CTRL, TTYKEY_RAW },
+ { 0, "\033[D", KEYC_LEFT|KEYC_CTRL, TTYKEY_RAW },
{ 0, "\033Oa", KEYC_UP|KEYC_CTRL, TTYKEY_RAW },
{ 0, "\033Ob", KEYC_DOWN|KEYC_CTRL, TTYKEY_RAW },
{ 0, "\033Oc", KEYC_RIGHT|KEYC_CTRL, TTYKEY_RAW },
{ 0, "\033Od", KEYC_LEFT|KEYC_CTRL, TTYKEY_RAW },
+
{ 0, "\033[a", KEYC_UP|KEYC_SHIFT, TTYKEY_RAW },
{ 0, "\033[b", KEYC_DOWN|KEYC_SHIFT, TTYKEY_RAW },
{ 0, "\033[c", KEYC_RIGHT|KEYC_SHIFT, TTYKEY_RAW },