diff console/libgnt/gntkeys.c @ 14976:1c0772f7260b

[gaim-migrate @ 17755] Decide the values for ctrl-up/down at startup depending on $TERM. committer: Tailor Script <tailor@pidgin.im>
author Sadrul Habib Chowdhury <imadil@gmail.com>
date Wed, 15 Nov 2006 20:39:32 +0000
parents 2ccce4e114ca
children b28f5caf9445
line wrap: on
line diff
--- a/console/libgnt/gntkeys.c	Wed Nov 15 20:11:01 2006 +0000
+++ b/console/libgnt/gntkeys.c	Wed Nov 15 20:39:32 2006 +0000
@@ -5,7 +5,7 @@
 
 static const char *term;
 
-void gnt_keys_refine(char *text)
+void gnt_init_keys()
 {
 	if (term == NULL) {
 		term = getenv("TERM");
@@ -13,6 +13,21 @@
 			term = "";  /* Just in case */
 	}
 
+	if (strcmp(term, "xterm") == 0 || strcmp(term, "rxvt") == 0) {
+		gnt_key_cup    = "\033" "[1;5A";
+		gnt_key_cdown  = "\033" "[1;5B";
+		gnt_key_cright = "\033" "[1;5C";
+		gnt_key_cleft  = "\033" "[1;5D";
+	} else if (strcmp(term, "screen") == 0 || strcmp(term, "rxvt-unicode") == 0) {
+		gnt_key_cup    = "\033" "Oa";
+		gnt_key_cdown  = "\033" "Ob";
+		gnt_key_cright = "\033" "Oc";
+		gnt_key_cleft  = "\033" "Od";
+	}
+}
+
+void gnt_keys_refine(char *text)
+{
 	if (*text == 27 && *(text + 1) == '[' && *(text + 3) == '\0' &&
 			(*(text + 2) >= 'A' && *(text + 2) <= 'D')) {
 		/* Apparently this is necessary for urxvt and screen and xterm */