Index: wp-admin/admin-ajax.php
===================================================================
--- wp-admin/admin-ajax.php	(revision 4040)
+++ wp-admin/admin-ajax.php	(working copy)
@@ -144,26 +144,22 @@
 		die('0');
 	if ( !$cat = get_category( $cat ) )
 		die('0');
-	$pad = 0;
+	$level = 0;
+	$cat_full_name = $cat->cat_name;
 	$_cat = $cat;
 	while ( $_cat->category_parent ) {
 		$_cat = get_category( $_cat->category_parent );
-		$pad++;
+		$cat_full_name = $_cat->cat_name . ' &#8212; ' . $cat_full_name;
+		$level++;
 	}
-	$pad = str_repeat('&#8212; ', $pad);
+	$cat_full_name = wp_specialchars( $cat_full_name, 1 );
 
 	$r  = "<?xml version='1.0' standalone='yes'?><ajaxresponse>";
-	$r .= "<cat><id>$cat->cat_ID</id><newitem><![CDATA[<table><tbody>";
-	$r .= "<tr id='cat-$cat->cat_ID'><th scope='row'>$cat->cat_ID</th><td>$pad $cat->cat_name</td>";
-	$r .= "<td>$cat->category_description</td><td>$cat->category_count</td><td>$cat->link_count</td>";
-	$r .= "<td><a href='categories.php?action=edit&amp;cat_ID=$cat->cat_ID' class='edit'>" . __('Edit') . "</a></td>";
-	$r .= "<td><a href='categories.php?action=delete&amp;cat_ID=$cat->cat_ID' onclick='return deleteSomething( \"cat\", $cat->cat_ID, \"";
-	$r .= sprintf(__('You are about to delete the category \"%s\".  All of its posts and bookmarks will go to the default categories.\\n\"OK\" to delete, \"Cancel\" to stop.'), addslashes($cat->cat_name));
-	$r .= "\" );' class='delete'>".__('Delete')."</a></td></tr>";
+	$r .= "<cat><id>$cat->cat_ID</id><name>$cat_full_name</name><newitem><![CDATA[<table><tbody>";
+	$r .= _cat_row( $cat, $level, $cat_full_name );
 	$r .= "</tbody></table>]]></newitem></cat></ajaxresponse>";
 	header('Content-type: text/xml');
 	die($r);
-
 	break;
 case 'add-meta' :
 	if ( !current_user_can( 'edit_post', $id ) )
Index: wp-admin/admin-functions.php
===================================================================
--- wp-admin/admin-functions.php	(revision 4040)
+++ wp-admin/admin-functions.php	(working copy)
@@ -684,39 +684,13 @@
 
 // Dandy new recursive multiple category stuff.
 function cat_rows($parent = 0, $level = 0, $categories = 0) {
-	global $wpdb, $class;
-
 	if (!$categories)
 		$categories = get_categories('hide_empty=0');
 
 	if ($categories) {
 		foreach ($categories as $category) {
 			if ($category->category_parent == $parent) {
-				$category->cat_name = wp_specialchars($category->cat_name,'double');
-				$pad = str_repeat('&#8212; ', $level);
-				if ( current_user_can('manage_categories') ) {
-					$edit = "<a href='categories.php?action=edit&amp;cat_ID=$category->cat_ID' class='edit'>".__('Edit')."</a></td>";
-					$default_cat_id = get_option('default_category');
-					$default_link_cat_id = get_option('default_link_category');
-
-					if ( ($category->cat_ID != $default_cat_id) && ($category->cat_ID != $default_link_cat_id) )
-						$edit .= "<td><a href='" . wp_nonce_url("categories.php?action=delete&amp;cat_ID=$category->cat_ID", 'delete-category_' . $category->cat_ID ) . "' onclick=\"return deleteSomething( 'cat', $category->cat_ID, '" . sprintf(__("You are about to delete the category &quot;%s&quot;.\\nAll of its posts will go into the default category of &quot;%s&quot;\\nAll of its bookmarks will go into the default category of &quot;%s&quot;.\\n&quot;OK&quot; to delete, &quot;Cancel&quot; to stop."), js_escape($category->cat_name), js_escape(get_catname($default_cat_id)), js_escape(get_catname($default_link_cat_id))) . "' );\" class='delete'>".__('Delete')."</a>";
-					else
-						$edit .= "<td style='text-align:center'>".__("Default");
-				}
-				else
-					$edit = '';
-
-				$class = ('alternate' == $class) ? '' : 'alternate';
-				
-				$category->category_count = number_format( $category->category_count );
-				$category->link_count = number_format( $category->link_count );
-				echo "<tr id='cat-$category->cat_ID' class='$class'><th scope='row'>$category->cat_ID</th><td>$pad $category->cat_name</td>
-								<td>$category->category_description</td>
-								<td align='center'>$category->category_count</td>
-								<td align='center'>$category->link_count</td>
-								<td>$edit</td>
-								</tr>";
+				echo "\t" . _cat_row( $category, $level );
 				cat_rows($category->cat_ID, $level +1, $categories);
 			}
 		}
@@ -725,6 +699,35 @@
 	}
 }
 
+function _cat_row( $category, $level, $name_override = false ) {
+	global $class;
+
+	$pad = str_repeat('&#8212; ', $level);
+	if ( current_user_can('manage_categories') ) {
+		$edit = "<a href='categories.php?action=edit&amp;cat_ID=$category->cat_ID' class='edit'>".__('Edit')."</a></td>";
+		$default_cat_id = get_option('default_category');
+		$default_link_cat_id = get_option('default_link_category');
+
+		if ( ($category->cat_ID != $default_cat_id) && ($category->cat_ID != $default_link_cat_id) )
+			$edit .= "<td><a href='" . wp_nonce_url("categories.php?action=delete&amp;cat_ID=$category->cat_ID", 'delete-category_' . $category->cat_ID ) . "' onclick=\"return deleteSomething( 'cat', $category->cat_ID, '" . sprintf(__("You are about to delete the category &quot;%s&quot;.\\nAll of its posts will go into the default category of &quot;%s&quot;\\nAll of its bookmarks will go into the default category of &quot;%s&quot;.\\n&quot;OK&quot; to delete, &quot;Cancel&quot; to stop."), js_escape($category->cat_name), js_escape(get_catname($default_cat_id)), js_escape(get_catname($default_link_cat_id))) . "' );\" class='delete'>".__('Delete')."</a>";
+		else
+			$edit .= "<td style='text-align:center'>".__("Default");
+	} else
+		$edit = '';
+
+	$class = ( ( defined('DOING_AJAX') && DOING_AJAX ) || " class='alternate'" == $class ) ? '' : " class='alternate'";
+
+	$category->category_count = number_format( $category->category_count );
+	$category->link_count = number_format( $category->link_count );
+	return "<tr id='cat-$category->cat_ID'$class>
+		<th scope='row'>$category->cat_ID</th>
+		<td>" . ( $name_override ? $name_override : $pad . ' ' . $category->cat_name ) . "</td>
+		<td>$category->category_description</td>
+		<td align='center'>$category->category_count</td>
+		<td align='center'>$category->link_count</td>
+		<td>$edit</td>\n\t</tr>\n";
+}
+
 function page_rows($parent = 0, $level = 0, $pages = 0, $hierarchy = true) {
 	global $wpdb, $class, $post;
 
Index: wp-admin/admin-db.php
===================================================================
--- wp-admin/admin-db.php	(revision 4040)
+++ wp-admin/admin-db.php	(working copy)
@@ -108,7 +108,7 @@
 	$category_description = apply_filters('pre_category_description', $category_description);
 
 	$category_parent = (int) $category_parent;
-	if (empty ($category_parent))
+	if ( empty($category_parent) || !get_category( $category_parent ) )
 		$category_parent = 0;
 
 	if ( isset($posts_private) )
Index: wp-admin/categories.js
===================================================================
--- wp-admin/categories.js	(revision 4040)
+++ wp-admin/categories.js	(working copy)
@@ -1,5 +1,16 @@
-addLoadEvent(newCategoryAddIn);
-function newCategoryAddIn() {
+addLoadEvent(function() {
 	if (!theList.theList) return false;
 	document.forms.addcat.submit.onclick = function(e) {return killSubmit('theList.ajaxAdder("cat", "addcat");', e); };
-}
+	theList.addComplete = function(what, where, update) {
+		var name = getNodeValue(theList.ajaxAdd.responseXML, 'name');
+		var id = getNodeValue(theList.ajaxAdd.responseXML, 'id');
+		var options = document.forms['addcat'].category_parent.options;
+		options[options.length] = new Option(name, id);
+	};
+	theList.delComplete = function(what, id) {
+		var options = document.forms['addcat'].category_parent.options;
+		for ( var o = 0; o < options.length; o++ )
+			if ( id == options[o].value )
+				options[o] = null;
+	};
+});
