Index: wp-admin/includes/template.php
===================================================================
--- wp-admin/includes/template.php	(revision 12820)
+++ wp-admin/includes/template.php	(working copy)
@@ -671,6 +671,8 @@
  * @return unknown
  */
 function _tag_row( $tag, $level, $class = '', $taxonomy = 'post_tag' ) {
+
+if (!isset($tag->_found)) $class = " style='background-color:#EBEEEF;' ";
 		$count = number_format_i18n( $tag->count );
 		if ( 'post_tag' == $taxonomy ) 
 			$tagsel = 'tag';
@@ -769,85 +771,58 @@
 	// Get a page worth of tags
 	$start = ($page - 1) * $pagesize;
 
-	$args = array('offset' => $start, 'number' => $pagesize, 'hide_empty' => 0);
+	$args = array('hide_empty' => 0);
 
 	if ( !empty( $searchterms ) )
 		$args['search'] = $searchterms;
 
-	// convert it to table rows
-	$out = '';
-	$count = 0;
-	if ( is_taxonomy_hierarchical($taxonomy) ) {
-		// We'll need the full set of terms then.
-		$args['number'] = $args['offset'] = 0;
+	$children = array();
 
-		$terms = get_terms( $taxonomy, $args );
-		if ( !empty( $searchterms ) ) // Ignore children on searches.
-			$children = array();
-		else
-			$children = _get_term_hierarchy($taxonomy);
+	$_term_s = get_terms( $taxonomy, $args );
+	if (empty($_term_s)) return false;
 
-		// Some funky recursion to get the job done is contained within, Skip it for non-hierarchical taxonomies for performance sake
-		$out .= _term_rows($taxonomy, $terms, $children, $page, $pagesize, $count);
-	} else {
-		$terms = get_terms( $taxonomy, $args );
-		foreach( $terms as $term )
-			$out .= _tag_row( $term, 0, ++$count % 2 ? ' class="alternate"' : '', $taxonomy );
-	}
+	foreach($_term_s as $_term_) { $_term_->_found = true; $_terms[$_term_->term_id] = $_term_; }
+	unset($_term_s, $_term_);
 
-	// filter and send to screen
-	echo $out;
-	return $count;
-}
+	$terms = array_slice($_terms, $start, $pagesize, true);
 
-function _term_rows( $taxonomy, $terms, &$children, $page = 1, $per_page = 20, &$count, $parent = 0, $level = 0 ) {
+	$count = count($terms);
 
-	$start = ($page - 1) * $per_page;
-	$end = $start + $per_page;
+	if ( is_taxonomy_hierarchical($taxonomy) ) {
+		$children = _get_term_hierarchy($taxonomy);
+		foreach($terms as $term)
+		{
+			$my_parent = $term->parent; 
+			if (!$my_parent) continue; 
 
-	$output = '';
-	foreach ( $terms as $key => $term ) {
-
-		if ( $count >= $end )
-			break;
-
-		if ( $term->parent != $parent && empty($_GET['s']) )
-			continue;
-
-		// If the page starts in a subtree, print the parents.
-		if ( $count == $start && $term->parent > 0 && empty($_GET['s']) ) {
-			$my_parents = $parent_ids = array();
-			$p = $term->parent;
-			while ( $p ) {
-				$my_parent = get_term( $p, $taxonomy );
-				$my_parents[] = $my_parent;
-				$p = $my_parent->parent;
-				if ( in_array($p, $parent_ids) ) // Prevent parent loops.
-					break;
-				$parent_ids[] = $p;
-			}
-			unset($parent_ids);
-
-			$num_parents = count($my_parents);
-			$count -= $num_parents; // Do not include parents in the per-page count, This is due to paging issues with unknown numbers of rows.
-			while ( $my_parent = array_pop($my_parents) ) {
-				$output .=  "\t" . _tag_row( $my_parent, $level - $num_parents, ++$count % 2 ? ' class="alternate"' : '', $taxonomy );
-				$num_parents--;
-			}
+			do {  
+				$my_parent = (isset($_terms[$my_parent])) ? $_terms[$my_parent] : get_term( $my_parent, $taxonomy );  
+				if (!isset($terms[$my_parent->term_id])) $terms[$my_parent->term_id] = $my_parent;  
+				$my_parent    = $my_parent->parent;  
+			} while ( $my_parent );
 		}
+	}
 
-		if ( $count >= $start )
-			$output .= "\t" . _tag_row( $term, $level, ++$count % 2 ? ' class="alternate"' : '', $taxonomy );
-		else
-			++$count;
+	// convert it to table rows (recursivity only applies to hierarchies so no performance issue)
+	echo _term_rows($taxonomy, $terms, $children);
 
-		unset($terms[$key]);
+	return $count;
+}
 
-		if ( isset($children[$term->term_id]) )
-			$output .= _term_rows( $taxonomy, $terms, $children, $page, $per_page, $count, $term->term_id, $level + 1 );
-	}
+function _term_rows( $taxonomy, &$terms, &$children, $level = 0, $parent = 0 ) {
 
-	return $output;
+	$output = '';
+	foreach ( $terms as $key => $term )  
+	{ 
+		if ( $parent == $term->parent )  
+		{
+			$output .= _tag_row( $term, $level ); // class alternate stuff not supported in crazyhorse ...
+			unset( $terms[ $key ] ); 
+			if ( isset($children[$term->term_id]) ) 
+			$output .= _term_rows( $taxonomy, $terms, $children, $level + 1, $term->term_id ); 
+		} 
+	} 
+	return $output; 
 }
 
 // define the columns to display, the syntax is 'internal name' => 'display name'
