fix arrow keys in csi-mode - sob - simple output bar
(HTM) git clone git://git.codemadness.org/sob
(DIR) Log
(DIR) Files
(DIR) Refs
(DIR) README
(DIR) LICENSE
---
(DIR) commit d52ae758f565c6a59c5ddb96995b2e364c507c4f
(DIR) parent c02257b852543ca38d39f9c2ae1654adecb398fb
(HTM) Author: Hiltjo Posthuma <hiltjo@codemadness.org>
Date: Fri, 3 Oct 2014 23:48:11 +0000
fix arrow keys in csi-mode
Diffstat:
M config.def.h | 29 ++++++++++++++++++++---------
1 file changed, 20 insertions(+), 9 deletions(-)
---
(DIR) diff --git a/config.def.h b/config.def.h
@@ -24,15 +24,22 @@ complete_nick(void)
#define CONTROL(ch) ((ch)^0x40)
-#define KEY_HOME "\x1b[\x31\x7e"
-#define KEY_END "\x1b[\x34\x7e"
+#define KEY_HOME "\x1b\x5b\x31\x7e"
+#define KEY_END "\x1b\x5b\x34\x7e"
#define KEY_CTRL_LEFT "\x1b\x5b\x31\x3b\x35\x44"
#define KEY_CTRL_RIGHT "\x1b\x5b\x31\x3b\x35\x43"
-#define KEY_LEFT "\x1b\x4f\x44"
-#define KEY_RIGHT "\x1b\x4f\x43"
-#define KEY_DOWN "\x1b\x4f\x42"
+/* Del */
+#define KEY_DC "\x1b\x5b\x33\x7e"
+/* SS3 DECCKM keys */
#define KEY_UP "\x1b\x4f\x41"
-#define KEY_DC "\x1b\x5b\x33\7e" /* del */
+#define KEY_DOWN "\x1b\x4f\x42"
+#define KEY_RIGHT "\x1b\x4f\x43"
+#define KEY_LEFT "\x1b\x4f\x44"
+/* CSI keys */
+#define KEY_CSI_UP "\x1b\x5b\x41"
+#define KEY_CSI_DOWN "\x1b\x5b\x42"
+#define KEY_CSI_RIGHT "\x1b\x5b\x43"
+#define KEY_CSI_LEFT "\x1b\x5b\x44"
static struct keybind {
unsigned char key[16];
@@ -44,16 +51,18 @@ static struct keybind {
{ { KEY_END }, line_cursor_end },
{ { CONTROL('B') }, line_cursor_prev },
{ { KEY_LEFT }, line_cursor_prev },
+ { { KEY_CSI_LEFT }, line_cursor_prev },
{ { CONTROL('F') }, line_cursor_next },
{ { KEY_RIGHT }, line_cursor_next },
+ { { KEY_CSI_RIGHT }, line_cursor_next },
{ { KEY_CTRL_LEFT }, line_cursor_wordprev },
{ { KEY_CTRL_RIGHT }, line_cursor_wordnext },
- { { CONTROL('W') }, line_delwordback },
- { { CONTROL('H') }, line_delcharback },
+ { { CONTROL('W') }, line_delwordprev },
+ { { CONTROL('H') }, line_delcharprev },
{ { CONTROL('U') }, line_clear },
{ { CONTROL('K') }, line_deltoend },
{ { KEY_DC }, line_delcharnext },
- { { CONTROL('H') }, line_delcharback },
+ { { CONTROL('H') }, line_delcharprev },
{ { CONTROL('M') }, line_newline },
{ { CONTROL('J') }, line_newline },
{ { '\r' }, line_newline },
@@ -62,7 +71,9 @@ static struct keybind {
{ { CONTROL('D') }, line_exit },
{ { CONTROL('E') }, line_deltoend },
{ { KEY_UP }, history_menu },
+ { { KEY_CSI_UP }, history_menu },
{ { KEY_DOWN }, history_menu },
+ { { KEY_CSI_DOWN }, history_menu },
{ { CONTROL('P') }, history_menu },
{ { CONTROL('N') }, history_menu },
{ { '\t' }, complete_nick },