changeset 24098:dc8fac020fad

Fix a bug where some key-bindings wouldn't work with some .
author Sadrul Habib Chowdhury <imadil@gmail.com>
date Sat, 20 Sep 2008 02:45:13 +0000
parents f3788288961b
children a1a88c1bd59e
files ChangeLog finch/libgnt/gntkeys.c
diffstat 2 files changed, 7 insertions(+), 5 deletions(-) [+]
line wrap: on
line diff
--- a/ChangeLog	Fri Sep 19 14:36:44 2008 +0000
+++ b/ChangeLog	Sat Sep 20 02:45:13 2008 +0000
@@ -17,6 +17,8 @@
 	Finch:
 	* A new 'Nested Grouping' option in the 'Grouping' plugin. Group
 	  hierarchies are defined by the '/' character in the group names
+	* A bug was fixed where some key-bindings wouldn't work with some TERMs
+	  (e.g. xterm-color, screen-linux etc.)
 
 version 2.5.1 (08/30/2008):
 	libpurple:
--- a/finch/libgnt/gntkeys.c	Fri Sep 19 14:36:44 2008 +0000
+++ b/finch/libgnt/gntkeys.c	Sat Sep 20 02:45:13 2008 +0000
@@ -47,12 +47,12 @@
 			term = "";  /* Just in case */
 	}
 
-	if (strcmp(term, "xterm") == 0 || strcmp(term, "rxvt") == 0) {
+	if (strstr(term, "xterm") == term || 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) {
+	} else if (strstr(term, "screen") == term || strcmp(term, "rxvt-unicode") == 0) {
 		gnt_key_cup    = "\033" "Oa";
 		gnt_key_cdown  = "\033" "Ob";
 		gnt_key_cright = "\033" "Oc";
@@ -147,11 +147,11 @@
 	if (*text == 27 && *(text + 1) == '[' &&
 			(*(text + 2) >= 'A' && *(text + 2) <= 'D')) {
 		/* Apparently this is necessary for urxvt and screen and xterm */
-		if (strcmp(term, "screen") == 0 || strcmp(term, "rxvt-unicode") == 0 ||
-				strcmp(term, "xterm") == 0)
+		if (strstr(term, "screen") == term || strcmp(term, "rxvt-unicode") == 0 ||
+				strstr(term, "xterm") == term)
 			*(text + 1) = 'O';
 	} else if (*(unsigned char*)text == 195) {
-		if (*(text + 2) == 0 && strcmp(term, "xterm") == 0) {
+		if (*(text + 2) == 0 && strstr(term, "xterm") == term) {
 			*(text) = 27;
 			*(text + 1) -= 64;  /* Say wha? */
 		}