--- vte-0.19.1/src/marshal.list-orig	2008-12-05 20:30:08.605053456 -0600
+++ vte-0.19.1/src/marshal.list	2008-12-05 20:30:23.854388579 -0600
@@ -5,3 +5,4 @@ VOID:INT
 VOID:INT,INT
 VOID:UINT,UINT
 VOID:OBJECT,OBJECT
+VOID:ENUM
--- vte-0.19.1/src/vte.h-orig	2008-12-05 20:30:02.330106517 -0600
+++ vte-0.19.1/src/vte.h	2008-12-05 20:30:23.855170945 -0600
@@ -59,6 +59,22 @@ struct _VteTerminal {
 	VteTerminalPrivate *pvt;
 };
 
+/* Key handling */
+typedef enum
+{
+   VTE_SCROLL_START,
+   VTE_SCROLL_END,
+   VTE_SCROLL_PAGE_UP,
+   VTE_SCROLL_PAGE_DOWN,
+   VTE_SCROLL_UP,
+   VTE_SCROLL_DOWN,
+   VTE_ADD,
+   VTE_SUBTRACT
+} VteKeyType;
+
+#define VTE_KEY_TYPE (vte_key_type ())
+GType vte_key_type (void);
+
 /* The widget's class structure. */
 typedef struct _VteTerminalClass VteTerminalClass;
 struct _VteTerminalClass {
@@ -107,6 +123,8 @@ struct _VteTerminalClass {
 
  	void (*beep)(VteTerminal* terminal);
 
+	void (*key_sequence)(VteTerminal* terminal, VteKeyType type);
+
 	/* Padding for future expansion. */
 	void (*vte_reserved3)(void);
 	void (*vte_reserved4)(void);
@@ -144,6 +162,8 @@ struct _VteTerminalClass {
 	guint text_deleted_signal;
 	guint text_scrolled_signal;
 
+	guint key_sequence_signal;
+
 	guint reserved1;
 	guint reserved2;
 	guint reserved3;
--- vte-0.19.1/src/vte.c-orig	2008-12-05 20:29:58.881770061 -0600
+++ vte-0.19.1/src/vte.c	2008-12-05 20:32:37.265749844 -0600
@@ -127,6 +127,8 @@ static void vte_terminal_set_font_full_i
 static gboolean process_timeout (gpointer data);
 static gboolean update_timeout (gpointer data);
 
+static void vte_key_sequence (VteTerminal *terminal, VteKeyType type);
+
 enum {
     COPY_CLIPBOARD,
     PASTE_CLIPBOARD,
@@ -171,6 +173,26 @@ static gboolean in_update_timeout;
 static GList *active_terminals;
 static GTimer *process_timer;
 
+GType vte_key_type (void)
+{
+   static GType etype = 0;
+   if (etype == 0) {
+      static const GEnumValue values[] = {
+         { VTE_SCROLL_START,     "VTE_SCROLL_START",     "scroll start" },
+         { VTE_SCROLL_END,       "VTE_SCROLL_END",       "scroll end" },
+         { VTE_SCROLL_PAGE_UP,   "VTE_SCROLL_PAGE_UP",   "scroll page up" },
+         { VTE_SCROLL_PAGE_DOWN, "VTE_SCROLL_PAGE_DOWN", "scroll page down" },
+         { VTE_SCROLL_UP,        "VTE_SCROLL_UP",        "up" },
+         { VTE_SCROLL_DOWN,      "VTE_SCROLL_DOWN",      "down" },
+         { VTE_ADD,              "VTE_ADD",              "add" },
+         { VTE_SUBTRACT,         "VTE_SUBTRACT",         "subtract" },
+         { 0, NULL, NULL }
+      };
+      etype = g_enum_register_static ("VteKeyType", values);
+   }
+   return etype;
+} 
+
 /* process incoming data without copying */
 static struct _vte_incoming_chunk *free_chunks;
 G_LOCK_DEFINE_STATIC(free_chunks);
@@ -4744,7 +4766,7 @@ vte_terminal_key_press(GtkWidget *widget
 	int i;
 	const char *special = NULL;
 	struct termios tio;
-	gboolean scrolled = FALSE, steal = FALSE, modifier = FALSE, handled,
+	gboolean steal = FALSE, modifier = FALSE, handled,
 		 suppress_meta_esc = FALSE;
 	guint keyval = 0;
 	gunichar keychar = 0;
@@ -4936,80 +4958,6 @@ vte_terminal_key_press(GtkWidget *widget
 				suppress_meta_esc = TRUE;
 			}
 			break;
-		/* Keypad/motion keys. */
-		case GDK_KP_Up:
-		case GDK_Up:
-			if (terminal->pvt->modifiers & GDK_CONTROL_MASK 
-                            && terminal->pvt->modifiers & GDK_SHIFT_MASK) {
-				vte_terminal_scroll_lines(terminal, -1);
-				scrolled = TRUE;
-				handled = TRUE;
-				suppress_meta_esc = TRUE;
-			}
-			break;
-		case GDK_KP_Down:
-		case GDK_Down:
-			if (terminal->pvt->modifiers & GDK_CONTROL_MASK
-                            && terminal->pvt->modifiers & GDK_SHIFT_MASK) {
-				vte_terminal_scroll_lines(terminal, 1);
-				scrolled = TRUE;
-				handled = TRUE;
-				suppress_meta_esc = TRUE;
-			}
-			break;
-		case GDK_KP_Page_Up:
-		case GDK_Page_Up:
-			if (terminal->pvt->modifiers & GDK_SHIFT_MASK) {
-				vte_terminal_scroll_pages(terminal, -1);
-				scrolled = TRUE;
-				handled = TRUE;
-				suppress_meta_esc = TRUE;
-			}
-			break;
-		case GDK_KP_Page_Down:
-		case GDK_Page_Down:
-			if (terminal->pvt->modifiers & GDK_SHIFT_MASK) {
-				vte_terminal_scroll_pages(terminal, 1);
-				scrolled = TRUE;
-				handled = TRUE;
-				suppress_meta_esc = TRUE;
-			}
-			break;
-		case GDK_KP_Home:
-		case GDK_Home:
-			if (terminal->pvt->modifiers & GDK_SHIFT_MASK) {
-				vte_terminal_maybe_scroll_to_top(terminal);
-				scrolled = TRUE;
-				handled = TRUE;
-			}
-			break;
-		case GDK_KP_End:
-		case GDK_End:
-			if (terminal->pvt->modifiers & GDK_SHIFT_MASK) {
-				vte_terminal_maybe_scroll_to_bottom(terminal);
-				scrolled = TRUE;
-				handled = TRUE;
-			}
-			break;
-		/* Let Shift +/- tweak the font, like XTerm does. */
-		case GDK_KP_Add:
-		case GDK_KP_Subtract:
-			if (terminal->pvt->modifiers &
-			    (GDK_SHIFT_MASK | GDK_CONTROL_MASK)) {
-				switch (keyval) {
-				case GDK_KP_Add:
-					vte_terminal_emit_increase_font_size(terminal);
-					handled = TRUE;
-					suppress_meta_esc = TRUE;
-					break;
-				case GDK_KP_Subtract:
-					vte_terminal_emit_decrease_font_size(terminal);
-					handled = TRUE;
-					suppress_meta_esc = TRUE;
-					break;
-				}
-			}
-			break;
 		default:
 			break;
 		}
@@ -5118,8 +5066,7 @@ vte_terminal_key_press(GtkWidget *widget
 			g_free(normal);
 		}
 		/* Keep the cursor on-screen. */
-		if (!scrolled && !modifier &&
-		    terminal->pvt->scroll_on_keystroke) {
+		if (!modifier && terminal->pvt->scroll_on_keystroke) {
 			vte_terminal_maybe_scroll_to_bottom(terminal);
 		}
 		return TRUE;
@@ -11309,6 +11256,8 @@ vte_terminal_class_init(VteTerminalClass
 	klass->copy_clipboard = vte_terminal_real_copy_clipboard;
 	klass->paste_clipboard = vte_terminal_real_paste_clipboard;
 
+	klass->key_sequence = vte_key_sequence;
+
 	klass->set_scroll_adjustments = vte_terminal_set_scroll_adjustments;
 
         klass->beep = NULL;
@@ -12025,6 +11974,16 @@ vte_terminal_class_init(VteTerminalClass
                                        FALSE,
                                        G_PARAM_READWRITE | STATIC_PARAMS));
      
+	klass->key_sequence_signal =
+		g_signal_new("key-sequence",
+			     G_OBJECT_CLASS_TYPE(klass),
+			     G_SIGNAL_RUN_LAST | G_SIGNAL_ACTION,
+			     G_STRUCT_OFFSET(VteTerminalClass, key_sequence),
+			     NULL,
+			     NULL,
+			     _vte_marshal_VOID__ENUM,
+			     G_TYPE_NONE, 1, VTE_KEY_TYPE);
+
         /* Keybindings */
 	binding_set = gtk_binding_set_by_class(klass);
 
@@ -12033,6 +11992,64 @@ vte_terminal_class_init(VteTerminalClass
 	gtk_binding_entry_add_signal(binding_set, GDK_F18, 0, "paste-clipboard", 0);
 	gtk_binding_entry_add_signal(binding_set, GDK_F20, 0, "copy-clipboard",0);
 
+
+ 	gtk_binding_entry_add_signal(binding_set, GDK_Home,
+ 				     GDK_SHIFT_MASK, "key-sequence",
+ 				     1, G_TYPE_ENUM,
+ 				     VTE_SCROLL_START);
+ 	gtk_binding_entry_add_signal(binding_set, GDK_KP_Home,
+ 				     GDK_SHIFT_MASK, "key-sequence",
+ 				     1, G_TYPE_ENUM,
+ 				     VTE_SCROLL_START);
+ 	gtk_binding_entry_add_signal(binding_set, GDK_End,
+ 				     GDK_SHIFT_MASK, "key-sequence",
+ 				     1, G_TYPE_ENUM,
+ 				     VTE_SCROLL_END);
+ 	gtk_binding_entry_add_signal(binding_set, GDK_KP_End,
+ 				     GDK_SHIFT_MASK, "key-sequence",
+ 				     1, G_TYPE_ENUM,
+ 				     VTE_SCROLL_END);
+ 	gtk_binding_entry_add_signal(binding_set, GDK_Page_Up,
+ 				     GDK_SHIFT_MASK, "key-sequence",
+ 				     1, G_TYPE_ENUM,
+ 				     VTE_SCROLL_PAGE_UP);
+ 	gtk_binding_entry_add_signal(binding_set, GDK_KP_Page_Up,
+ 				     GDK_SHIFT_MASK, "key-sequence",
+ 				     1, G_TYPE_ENUM,
+ 				     VTE_SCROLL_PAGE_UP);
+ 	gtk_binding_entry_add_signal(binding_set, GDK_Page_Down,
+ 				     GDK_SHIFT_MASK, "key-sequence",
+ 				     1, G_TYPE_ENUM,
+ 				     VTE_SCROLL_PAGE_DOWN);
+ 	gtk_binding_entry_add_signal(binding_set, GDK_KP_Page_Down,
+ 				     GDK_SHIFT_MASK, "key-sequence",
+ 				     1, G_TYPE_ENUM,
+ 				     VTE_SCROLL_PAGE_DOWN);
+ 	gtk_binding_entry_add_signal(binding_set, GDK_Up,
+ 				     GDK_SHIFT_MASK, "key-sequence",
+ 				     1, G_TYPE_ENUM,
+ 				     VTE_SCROLL_UP);
+ 	gtk_binding_entry_add_signal(binding_set, GDK_KP_Up,
+ 				     GDK_SHIFT_MASK, "key-sequence",
+ 				     1, G_TYPE_ENUM,
+ 				     VTE_SCROLL_UP);
+ 	gtk_binding_entry_add_signal(binding_set, GDK_Down,
+ 				     GDK_SHIFT_MASK, "key-sequence",
+ 				     1, G_TYPE_ENUM,
+ 				     VTE_SCROLL_DOWN);
+ 	gtk_binding_entry_add_signal(binding_set, GDK_KP_Down,
+ 				     GDK_SHIFT_MASK, "key-sequence",
+ 				     1, G_TYPE_ENUM,
+ 				     VTE_SCROLL_DOWN);
+ 	gtk_binding_entry_add_signal(binding_set, GDK_KP_Add,
+ 				     GDK_SHIFT_MASK, "key-sequence",
+ 				     1, G_TYPE_ENUM,
+ 				     VTE_ADD);
+ 	gtk_binding_entry_add_signal(binding_set, GDK_KP_Subtract,
+ 				     GDK_SHIFT_MASK, "key-sequence",
+ 				     1, G_TYPE_ENUM,
+ 				     VTE_SUBTRACT);
+ 
 	process_timer = g_timer_new ();
 }
 
@@ -13665,6 +13682,39 @@ _vte_terminal_remove_selection(VteTermin
 }
 
 static void
+vte_key_sequence(VteTerminal *terminal, VteKeyType type)
+{
+	switch (type) {
+	case VTE_SCROLL_START:
+				vte_terminal_maybe_scroll_to_top(terminal);
+				break;
+	case VTE_SCROLL_END:
+				vte_terminal_maybe_scroll_to_bottom(terminal);
+				break;
+	case VTE_SCROLL_PAGE_UP:
+				vte_terminal_scroll_pages(terminal, -1);
+				break;
+	case VTE_SCROLL_PAGE_DOWN:
+				vte_terminal_scroll_pages(terminal, 1);
+				break;
+        case VTE_SCROLL_UP:
+				vte_terminal_scroll_lines(terminal, -1);
+				break;
+        case VTE_SCROLL_DOWN:
+				vte_terminal_scroll_lines(terminal, 1);
+				break;
+        case VTE_ADD:
+				vte_terminal_emit_increase_font_size(terminal);
+				break;
+        case VTE_SUBTRACT:
+				vte_terminal_emit_decrease_font_size(terminal);
+				break;
+	default:
+				break;
+	}
+}
+
+static void
 add_update_timeout (VteTerminal *terminal)
 {
 	if (update_timeout_tag == VTE_INVALID_SOURCE) {
