--- gtk+-2.4.14/gtk/gtktreeview.c	2005-04-22 15:20:19.000000000 +0530
+++ gtk+-2.4.14-new/gtk/gtktreeview.c	2005-04-29 18:44:54.503601088 +0530
@@ -8130,6 +8130,11 @@ gtk_tree_view_move_cursor_up_down (GtkTr
   GtkRBTree *new_cursor_tree = NULL;
   GtkRBNode *new_cursor_node = NULL;
   GtkTreePath *cursor_path = NULL;
+  GtkTreeSelection *selection;
+  GtkTreeModel     *model;
+  GList            *selected_rows;
+  gboolean mask_key_pressed = (tree_view->priv->shift_pressed || 
+			       tree_view->priv->ctrl_pressed);
 
   if (! GTK_WIDGET_HAS_FOCUS (tree_view))
     return;
@@ -8154,34 +8159,55 @@ gtk_tree_view_move_cursor_up_down (GtkTr
     _gtk_rbtree_next_full (cursor_tree, cursor_node,
 			   &new_cursor_tree, &new_cursor_node);
 
+  selection = gtk_tree_view_get_selection (tree_view);
+  selected_rows = gtk_tree_selection_get_selected_rows (selection, &model);
+
   /*
-   * If the list has only one item and multi-selection is set then select
-   * the row.
+   * If there is focus on an item, then pressing Up/Down should select it. 
+   *  
    */
-  if (tree_view->priv->selection->type == GTK_SELECTION_MULTIPLE &&
-      new_cursor_node == NULL)
+  if (new_cursor_node == NULL)
     {
-      if (count == -1)
-        _gtk_rbtree_next_full (cursor_tree, cursor_node,
+      if (tree_view->priv->selection->type == GTK_SELECTION_MULTIPLE)
+	{
+	  if (count == -1)
+	    _gtk_rbtree_next_full (cursor_tree, cursor_node,
     			       &new_cursor_tree, &new_cursor_node);
-      else
-        _gtk_rbtree_prev_full (cursor_tree, cursor_node,
+	  else
+	    _gtk_rbtree_prev_full (cursor_tree, cursor_node,
 			       &new_cursor_tree, &new_cursor_node);
 
-      if (new_cursor_node == NULL)
-        {
-          new_cursor_node = cursor_node;
-          new_cursor_tree = cursor_tree;
-        }
+	  if (new_cursor_node == NULL || (new_cursor_node != NULL && !selected_rows && !mask_key_pressed))
+	    {
+	      new_cursor_node = cursor_node;
+	      new_cursor_tree = cursor_tree;
+	    }
+	  else
+	    {
+	      new_cursor_node = NULL;
+	    }
+	}
       else
-        {
-          new_cursor_node = NULL;
-        }
+	{
+	  if (!selected_rows && !mask_key_pressed)
+	    {
+	      new_cursor_node = cursor_node;
+	      new_cursor_tree = cursor_tree;
+	    }
+	}
     }
 
   if (new_cursor_node)
     {
-      cursor_path = _gtk_tree_view_find_path (tree_view, new_cursor_tree, new_cursor_node);
+      if (!selected_rows && !mask_key_pressed)
+	{
+	  cursor_path = _gtk_tree_view_find_path (tree_view, cursor_tree, cursor_node);
+	}
+      else
+	{
+	  cursor_path = _gtk_tree_view_find_path (tree_view, new_cursor_tree, new_cursor_node);
+	}
+
       gtk_tree_view_real_set_cursor (tree_view, cursor_path, TRUE, TRUE);
       gtk_tree_path_free (cursor_path);
     }
@@ -8190,6 +8216,12 @@ gtk_tree_view_move_cursor_up_down (GtkTr
       gtk_tree_view_clamp_node_visible (tree_view, cursor_tree, cursor_node);
     }
 
+  if (selected_rows)
+    {
+      g_list_foreach (selected_rows, (GFunc)gtk_tree_path_free, NULL);
+      g_list_free (selected_rows);
+    }
+
   gtk_widget_grab_focus (GTK_WIDGET (tree_view));
 }
 
