Index: iso2022.c
===================================================================
RCS file: /cvs/gnome/vte/src/iso2022.c,v
retrieving revision 1.50
diff -u -3 -p -r1.50 iso2022.c
--- iso2022.c	15 Sep 2003 18:57:33 -0000	1.50
+++ iso2022.c	18 Aug 2004 18:40:39 -0000
@@ -862,35 +862,31 @@ _vte_iso2022_state_get_codeset(struct _v
 }
 
 static char *
-_vte_iso2022_better(char *p, char *q)
-{
-	if (p == NULL) {
-		return q;
-	}
-	if (q == NULL) {
-		return p;
-	}
-	return MIN(p, q);
-}
-
-static char *
 _vte_iso2022_find_nextctl(const char *p, size_t length)
 {
-	char *ret;
+	size_t i;
+	
 	if (length == 0) {
 		return NULL;
 	}
-	ret = memchr(p, '\033', length);
-	ret = _vte_iso2022_better(ret, memchr(p, '\n', length));
-	ret = _vte_iso2022_better(ret, memchr(p, '\r', length));
-	ret = _vte_iso2022_better(ret, memchr(p, '\016', length));
-	ret = _vte_iso2022_better(ret, memchr(p, '\017', length));
+
+	for (i = 0; i < length; i++) {
+	  if (*p == '\033' ||
+	      *p == '\n' ||
+	      *p == '\r' ||
+	      *p == '\016' ||
+	      *p == '\017'
 #ifdef VTE_ISO2022_8_BIT_CONTROLS
 	/* This breaks UTF-8 and other encodings which use the high bits. */
-	ret = _vte_iso2022_better(ret, memchr(p, 0x8e, length));
-	ret = _vte_iso2022_better(ret, memchr(p, 0x8f, length));
+	      ||
+	      *p == 0x8e ||
+	      *p == 0x8f
 #endif
-	return ret;
+	     )
+	    return (char *) p; /* FIXME */
+	  p++;
+	}
+	return NULL;
 }
 
 static long
