Index: src/keymap.c
===================================================================
--- src/keymap.c	(revision 1887)
+++ src/keymap.c	(working copy)
@@ -1323,6 +1323,20 @@
 	return fkey;
 }
 
+gboolean
+is_f1_through_f4(guint keyval)
+{
+	switch (keyval) {
+	case GDK_F1:
+	case GDK_F2:
+	case GDK_F3:
+	case GDK_F4:
+		return TRUE;
+	default:
+		return FALSE;
+	}
+}
+
 void
 _vte_keymap_key_add_key_modifiers(guint keyval,
 				  GdkModifierType modifiers,
@@ -1396,21 +1410,22 @@
 			nnormal[offset + 0] = ';';
 			*normal_length += 2;
 		} else {
-#if 1
-			/* Stuff a "1", a semicolon and the modifier in right
-			 * before that last character, matching Xterm. */
-			nnormal[offset + 3] = nnormal[offset];
-			nnormal[offset + 2] = modifier + '0';
-			nnormal[offset + 1] = ';';
-			nnormal[offset + 0] = '1';
-			*normal_length += 3;
-#else
-			/* Stuff the modifier in right before that last
-			 * character, matching what people expect. */
-			nnormal[offset + 1] = nnormal[offset];
-			nnormal[offset + 0] = modifier + '0';
-			*normal_length += 1;
-#endif
+			/* F1 - F4 get special treatment, as per xterm */
+			if (!is_f1_through_f4(keyval)) {
+				/* Stuff a "1", a semicolon and the modifier in right
+				 * before that last character, matching Xterm. */
+				nnormal[offset + 3] = nnormal[offset];
+				nnormal[offset + 2] = modifier + '0';
+				nnormal[offset + 1] = ';';
+				nnormal[offset + 0] = '1';
+				*normal_length += 3;
+			} else {
+				/* Stuff the modifier in right before that last
+				 * character, matching what people expect. */
+				nnormal[offset + 1] = nnormal[offset];
+				nnormal[offset + 0] = modifier + '0';
+				*normal_length += 1;
+			}
 		}
 		g_free(*normal);
 		*normal = nnormal;
