Index: gtk/gtkenums.h
===================================================================
RCS file: /cvs/gnome/gtk+/gtk/gtkenums.h,v
retrieving revision 1.54
diff -u -b -B -p -r1.54 gtkenums.h
--- gtk/gtkenums.h	7 Apr 2003 18:19:44 -0000	1.54
+++ gtk/gtkenums.h	19 Apr 2003 00:51:22 -0000
@@ -193,7 +193,8 @@ typedef enum
   GTK_CENTIMETERS
 } GtkMetricType;
 
-typedef enum {
+typedef enum 
+{
   GTK_MOVEMENT_LOGICAL_POSITIONS, /* move by forw/back graphemes */
   GTK_MOVEMENT_VISUAL_POSITIONS,  /* move by left/right graphemes */
   GTK_MOVEMENT_WORDS,             /* move by forward/back words */
@@ -205,6 +206,16 @@ typedef enum {
   GTK_MOVEMENT_BUFFER_ENDS,       /* move to ends of the buffer */
   GTK_MOVEMENT_HORIZONTAL_PAGES   /* move horizontally by pages */
 } GtkMovementStep;
+
+typedef enum 
+{
+  GTK_SCROLL_STEPS,
+  GTK_SCROLL_PAGES,
+  GTK_SCROLL_ENDS,
+  GTK_SCROLL_HORIZONTAL_STEPS,
+  GTK_SCROLL_HORIZONTAL_PAGES,
+  GTK_SCROLL_HORIZONTAL_ENDS
+} GtkScrollStep;
 
 /* Orientation for toolbars, etc. */
 typedef enum
Index: gtk/gtktextview.c
===================================================================
RCS file: /cvs/gnome/gtk+/gtk/gtktextview.c,v
retrieving revision 1.228
diff -u -b -B -p -r1.228 gtktextview.c
--- gtk/gtktextview.c	14 Mar 2003 23:11:42 -0000	1.228
+++ gtk/gtktextview.c	19 Apr 2003 00:51:25 -0000
@@ -117,6 +117,7 @@ enum
   PASTE_CLIPBOARD,
   TOGGLE_OVERWRITE,
   MOVE_FOCUS,
+  MOVE_VIEWPORT,
   LAST_SIGNAL
 };
 
@@ -234,6 +235,9 @@ static void gtk_text_view_move_cursor   
 static void gtk_text_view_page_horizontally (GtkTextView          *text_view,
                                              gint                  count,
                                              gboolean              extend_selection);
+static void gtk_text_view_move_viewport     (GtkTextView           *text_view,
+                                             GtkScrollStep          step,
+                                             gint                   count);
 static void gtk_text_view_set_anchor       (GtkTextView           *text_view);
 static void gtk_text_view_scroll_pages     (GtkTextView           *text_view,
                                             gint                   count,
@@ -673,6 +677,17 @@ gtk_text_view_class_init (GtkTextViewCla
 		  G_TYPE_INT,
 		  G_TYPE_BOOLEAN);
   
+  signals[MOVE_VIEWPORT] =
+    _gtk_binding_signal_new ("move_viewport",
+			     G_OBJECT_CLASS_TYPE (gobject_class),
+			     G_SIGNAL_RUN_LAST | G_SIGNAL_ACTION,
+			     G_CALLBACK (gtk_text_view_move_viewport),
+			     NULL, NULL,
+			     _gtk_marshal_VOID__ENUM_INT,
+			     G_TYPE_NONE, 2,
+			     GTK_TYPE_SCROLL_STEP,
+			     G_TYPE_INT);
+
   signals[SET_ANCHOR] =
     g_signal_new ("set_anchor",
 		  G_OBJECT_CLASS_TYPE (gobject_class),
@@ -874,6 +889,18 @@ gtk_text_view_class_init (GtkTextViewCla
   add_move_binding (binding_set, GDK_KP_Page_Down, GDK_CONTROL_MASK,
                     GTK_MOVEMENT_HORIZONTAL_PAGES, 1);
 
+  add_move_binding (binding_set, GDK_Page_Up, GDK_CONTROL_MASK,
+                    GTK_MOVEMENT_HORIZONTAL_PAGES, -1);
+
+  add_move_binding (binding_set, GDK_KP_Page_Up, GDK_CONTROL_MASK,
+                    GTK_MOVEMENT_HORIZONTAL_PAGES, -1);
+  
+  add_move_binding (binding_set, GDK_Page_Down, GDK_CONTROL_MASK,
+                    GTK_MOVEMENT_HORIZONTAL_PAGES, 1);
+
+  add_move_binding (binding_set, GDK_KP_Page_Down, GDK_CONTROL_MASK,
+                    GTK_MOVEMENT_HORIZONTAL_PAGES, 1);
+
   /* Select all
    */
   gtk_binding_entry_add_signal (binding_set, GDK_a, GDK_CONTROL_MASK,
@@ -4481,6 +4508,44 @@ gtk_text_view_move_cursor_internal (GtkT
 
   gint cursor_x_pos = 0;
 
+  if (!text_view->cursor_visible) 
+    {
+      GtkScrollStep scroll_step;
+
+      switch (step) 
+	{
+	case GTK_MOVEMENT_LOGICAL_POSITIONS:
+        case GTK_MOVEMENT_VISUAL_POSITIONS:
+        case GTK_MOVEMENT_WORDS:
+	  scroll_step = GTK_SCROLL_HORIZONTAL_STEPS;
+	  break;
+        case GTK_MOVEMENT_DISPLAY_LINE_ENDS:
+	  scroll_step = GTK_SCROLL_HORIZONTAL_ENDS;
+	  break;	  
+        case GTK_MOVEMENT_DISPLAY_LINES:
+        case GTK_MOVEMENT_PARAGRAPHS:
+        case GTK_MOVEMENT_PARAGRAPH_ENDS:
+	  scroll_step = GTK_SCROLL_STEPS;
+	  break;
+	case GTK_MOVEMENT_PAGES:
+	  scroll_step = GTK_SCROLL_PAGES;
+	  break;
+	case GTK_MOVEMENT_HORIZONTAL_PAGES:
+	  scroll_step = GTK_SCROLL_HORIZONTAL_PAGES;
+	  break;
+	case GTK_MOVEMENT_BUFFER_ENDS:
+	  scroll_step = GTK_SCROLL_ENDS;
+	  break;
+	default:
+          scroll_step = GTK_SCROLL_PAGES;
+          break;
+	}
+      
+      gtk_text_view_move_viewport (text_view, scroll_step, count);
+
+      return;
+    }
+
   gtk_text_view_reset_im_context (text_view);
 
   if (step == GTK_MOVEMENT_PAGES)
@@ -4620,6 +4685,54 @@ gtk_text_view_page_horizontally (GtkText
 {
   gtk_text_view_move_cursor_internal (text_view, GTK_MOVEMENT_HORIZONTAL_PAGES,
                                       count, extend_selection);
+}
+
+
+static void
+gtk_text_view_move_viewport (GtkTextView     *text_view,
+                             GtkScrollStep    step,
+                             gint             count)
+{
+  GtkAdjustment *adjustment;
+  gdouble increment;
+  
+  switch (step) 
+    {
+    case GTK_SCROLL_STEPS:
+    case GTK_SCROLL_PAGES:
+    case GTK_SCROLL_ENDS:
+      adjustment = get_vadjustment (text_view);
+      break;
+    case GTK_SCROLL_HORIZONTAL_STEPS:
+    case GTK_SCROLL_HORIZONTAL_PAGES:
+    case GTK_SCROLL_HORIZONTAL_ENDS:
+      adjustment = get_hadjustment (text_view);
+      break;
+    default:
+      adjustment = get_vadjustment (text_view);
+      break;
+    }
+
+  switch (step) 
+    {
+    case GTK_SCROLL_STEPS:
+    case GTK_SCROLL_HORIZONTAL_STEPS:
+      increment = adjustment->step_increment;
+      break;
+    case GTK_SCROLL_PAGES:
+    case GTK_SCROLL_HORIZONTAL_PAGES:
+      increment = adjustment->page_increment;
+      break;
+    case GTK_SCROLL_ENDS:
+    case GTK_SCROLL_HORIZONTAL_ENDS:
+      increment = adjustment->upper - adjustment->lower;
+      break;
+    default:
+      increment = 0.0;
+      break;
+    }
+
+  set_adjustment_clamped (adjustment, adjustment->value + count * increment);
 }
 
 static void
