Index: plugin-editor.php
===================================================================
--- plugin-editor.php	(revision 36472)
+++ plugin-editor.php	(working copy)
@@ -14,10 +14,11 @@
 	exit();
 }
 
-if ( !current_user_can('edit_plugins') )
+if ( ! current_user_can('edit_plugins') ) {
 	wp_die( __('You do not have sufficient permissions to edit plugins for this site.') );
+}
 
-$title = __("Edit Plugins");
+$title = __('Edit Plugins');
 $parent_file = 'plugins.php';
 
 wp_reset_vars( array( 'action', 'error', 'file', 'plugin' ) );
@@ -36,6 +37,8 @@
 	exit;
 }
 
+$current_plugin = $plugin ? $plugin : null;
+
 if ( $file ) {
 	$plugin = $file;
 } elseif ( empty( $plugin ) ) {
@@ -45,8 +48,9 @@
 
 $plugin_files = get_plugin_files($plugin);
 
-if ( empty($file) )
+if ( empty( $file ) ) {
 	$file = $plugin_files[0];
+}
 
 $file = validate_file_to_edit($file, $plugin_files);
 $real_file = WP_PLUGIN_DIR . '/' . $file;
@@ -92,8 +96,9 @@
 		check_admin_referer('edit-plugin-test_' . $file);
 
 		$error = validate_plugin($file);
-		if ( is_wp_error($error) )
+		if ( is_wp_error( $error ) ) {
 			wp_die( $error );
+		}
 
 		if ( ( ! empty( $_GET['networkwide'] ) && ! is_plugin_active_for_network($file) ) || ! is_plugin_active($file) )
 			activate_plugin($file, "plugin-editor.php?file=$file&phperror=1", ! empty( $_GET['networkwide'] ) ); // we'll override this later if the plugin can be included without fatal error
@@ -121,10 +126,11 @@
 		if ( preg_match('/\.([^.]+)$/', $real_file, $matches) ) {
 			$ext = strtolower($matches[1]);
 			// If extension is not in the acceptable list, skip it
-			if ( !in_array( $ext, $editable_extensions) )
+			if ( ! in_array( $ext, $editable_extensions ) ) {
 				wp_die(sprintf('<p>%s</p>', __('Files of this type are not editable.')));
 		}
 	}
+	}
 
 	get_current_screen()->add_help_tab( array(
 	'id'		=> 'overview',
@@ -212,12 +218,12 @@
 		<strong><label for="plugin"><?php _e('Select plugin to edit:'); ?> </label></strong>
 		<select name="plugin" id="plugin">
 <?php
+	$errors = array();
 	foreach ( $plugins as $plugin_key => $a_plugin ) {
 		$plugin_name = $a_plugin['Name'];
-		if ( $plugin_key == $plugin )
-			$selected = " selected='selected'";
-		else
-			$selected = '';
+		
+		$selected = ( $plugin_key == $plugin || $plugin_key == $current_plugin ) ? ' selected="selected"' : '';
+		
 		$plugin_name = esc_attr($plugin_name);
 		$plugin_key = esc_attr($plugin_key);
 		echo "\n\t<option value=\"$plugin_key\" $selected>$plugin_name</option>";
