[hackers] [st] Add control and meta combinations for arrow keys || "Roberto E. Vargas Caballero"

From: <hg_AT_suckless.org>
Date: Tue, 13 Nov 2012 20:08:52 +0100 (CET)

changeset: 403:adadc40e7633
user: "Roberto E. Vargas Caballero" <k0ga_AT_shike2.com>
date: Tue Nov 13 20:04:54 2012 +0100
files: config.def.h st.info
description:
Add control and meta combinations for arrow keys
Since there isn't any terminfo capability for control and meta modifiers for
arrows keys it is necessary use the same that almost terminal emulators use,
because there are a lot of programs which have these codes hardcoded.

This cause also that shift combinations are also changed, but in this case
this is not a problem since there are terminfo capabilities for them. After
this patch shift-up and shift-down continue not working in emacs with
TERM=st, but they work with TERM=xterm, so it is possible some other changes
are necessary in the terminfo entry.
---
 config.def.h |   16 ++++++++++++----
 st.info      |    8 ++++----
 2 files changed, 16 insertions(+), 8 deletions(-)
diff -r c630baf587b7 -r adadc40e7633 config.def.h
--- a/config.def.h	Tue Nov 13 20:04:50 2012 +0100
+++ b/config.def.h	Tue Nov 13 20:04:54 2012 +0100
_AT_@ -80,16 +80,24 @@
 	{ XK_BackSpace,     XK_NO_MOD,      "\177",          0,    0,    0},
 	{ XK_Up,            XK_NO_MOD,      "\033[A",        0,   -1,    0},
 	{ XK_Up,            XK_NO_MOD,      "\033OA",        0,   +1,    0},
-	{ XK_Up,            ShiftMask,      "\033[a",        0,    0,    0},
+	{ XK_Up,            ShiftMask,      "\033[1;2A",     0,    0,    0},
+	{ XK_Up,            ControlMask,    "\033[1;5A",     0,    0,    0},
+	{ XK_Up,            Mod1Mask,       "\033[1;3A",     0,    0,    0},
 	{ XK_Down,          XK_NO_MOD,      "\033[B",        0,   -1,    0},
 	{ XK_Down,          XK_NO_MOD,      "\033OB",        0,   +1,    0},
-	{ XK_Down,          ShiftMask,      "\033[b",        0,    0,    0},
+	{ XK_Down,          ShiftMask,      "\033[1;2B",     0,    0,    0},
+	{ XK_Down,          ControlMask,    "\033[1;5B",     0,    0,    0},
+	{ XK_Down,          Mod1Mask,       "\033[1;3B",     0,    0,    0},
 	{ XK_Left,     	    XK_NO_MOD,      "\033[D",        0,   -1,    0},
 	{ XK_Left,          XK_NO_MOD,      "\033OD",        0,   +1,    0},
-	{ XK_Left,          ShiftMask,      "\033[d",        0,    0,    0},
+	{ XK_Left,          ShiftMask,      "\033[1;2D",     0,    0,    0},
+	{ XK_Left,          ControlMask,    "\033[1;5D",     0,    0,    0},
+	{ XK_Left,          Mod1Mask,       "\033[1;3D",     0,    0,    0},
 	{ XK_Right,         XK_NO_MOD,      "\033[C",        0,   -1,    0},
 	{ XK_Right,         XK_NO_MOD,      "\033OC",        0,   +1,    0},
-	{ XK_Right,         ShiftMask,      "\033[c",        0,    0,    0},
+	{ XK_Right,         ShiftMask,      "\033[1;2C",     0,    0,    0},
+	{ XK_Right,         ControlMask,    "\033[1;5C",     0,    0,    0},
+	{ XK_Right,         Mod1Mask,       "\033[1;3C",     0,    0,    0},
 	{ XK_Return,        XK_NO_MOD,      "\n",            0,    0,   -1},
 	{ XK_Return,        XK_NO_MOD,      "\r\n",          0,    0,   +1},
 	{ XK_Return,        Mod1Mask,       "\033\n",        0,    0,   -1},
diff -r c630baf587b7 -r adadc40e7633 st.info
--- a/st.info	Tue Nov 13 20:04:50 2012 +0100
+++ b/st.info	Tue Nov 13 20:04:54 2012 +0100
_AT_@ -54,10 +54,10 @@
 	kcud1=\EOB,
 	kcuf1=\EOC,
 	kcuu1=\EOA,
-	kLFT=\E[d,
-	kRIT=\E[c,
-	kind=\E[a,
-	kri=\E[b,
+	kLFT=\E[1;2D,
+	kRIT=\E[1;2C,
+	kind=\E[1;2B,
+	kri=\E[1;2A,
 	kdch1=\E[3~,
 	kich1=\E[2~,
 	kend=\E[4~,
Received on Tue Nov 13 2012 - 20:08:52 CET

This archive was generated by hypermail 2.3.0 : Tue Nov 13 2012 - 20:12:10 CET