Description: add "Selected" config option
Author: Fernando Vezzosi <fv@linuxvar.it>

--- a/src/main.c
+++ b/src/main.c
@@ -630,6 +630,10 @@ static void gmrun_activate(void)
    if (!config_get_int ("ShowLast", &shows_last_history_item)) {
       shows_last_history_item = 0;
    }
+   int last_history_selected = 0;
+   if (!config_get_int ("Selected", &last_history_selected)) {
+      last_history_selected = 1;
+   }
    if (gmrun_text) {
       gtk_entry_set_text (GTK_ENTRY(compline), gmrun_text);
    } else if (shows_last_history_item) {
@@ -667,7 +671,12 @@ static void gmrun_activate(void)
 
    gtk_widget_show_all (dialog);
 
-   gtk_window_set_focus (GTK_WINDOW(dialog), compline);
+   if (last_history_selected) {
+      gtk_editable_select_region (GTK_EDITABLE(compline), 0, strlen(gtk_entry_get_text(GTK_ENTRY(compline))));
+   } else {
+      gtk_editable_set_position (GTK_EDITABLE(compline), -1);
+   }
+
    if (gmrun_text) {
       // clear selection if command (text) is supplied as a parameter
       compline_clear_selection (GTK_COMPLETION_LINE (compline));
