--- evolution-2.9.92/mail/message-list.c.orig	2007-01-18 13:31:51.000000000 +0100
+++ evolution-2.9.92/mail/message-list.c	2007-03-12 12:42:47.000000000 +0100
@@ -2364,6 +2364,7 @@
 {
 	ETreePath node;
 	int last;
+	int vrow_orig;
 	int vrow;
 	ETree *et = ml->tree;
 	CamelMessageInfo *info;
@@ -2385,10 +2386,10 @@
 	last = e_tree_row_count (ml->tree);
 
 	/* model_to_view_row etc simply dont work for sorted views.  Sigh. */
-	vrow = e_tree_row_of_node (et, node);
+	vrow_orig = e_tree_row_of_node (et, node);
 
 	/* We already checked this node. */
-	vrow ++;
+	vrow = vrow_orig + 1;
 
 	while (vrow < last) {
 		node = e_tree_node_at_row (et, vrow);
@@ -2399,6 +2400,19 @@
 		vrow ++;
 	}
 
+	/* We didn't find any undeleted entries _below_ the currently selected one
+         * so let's try to find one _above_ */
+	vrow = vrow_orig - 1;
+
+	while (vrow >= 0) {
+		node = e_tree_node_at_row (et, vrow);
+		info = get_message_info (ml, node);
+		if (info && (camel_message_info_flags(info) & check) == 0) {
+			return g_strdup (camel_message_info_uid (info));
+		}
+		vrow --;
+	}
+
 	return NULL;
 }
 
