summaryrefslogtreecommitdiff
path: root/patches/80-selectoption.patch
blob: 86da288d14e1a635851c244242c58f55dafc45be (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
# Description: add "Selected" config option
# Author: Fernando Vezzosi <fv@linuxvar.it>

Index: gmrun-0.9.2/src/main.cc
===================================================================
--- gmrun-0.9.2.orig/src/main.cc	2010-02-03 12:37:52.455767905 +0800
+++ gmrun-0.9.2/src/main.cc	2010-02-03 12:38:46.801743816 +0800
@@ -615,6 +615,10 @@
   if (!configuration.get_int("ShowLast", shows_last_history_item)) {
     shows_last_history_item = 0;
   }
+  int last_history_selected = 0;
+  if (!configuration.get_int("Selected", last_history_selected)) {
+    last_history_selected = 1;
+  }
   if (shows_last_history_item) {
     gtk_completion_line_last_history_item(GTK_COMPLETION_LINE(compline));
   }
@@ -662,7 +666,11 @@
 
   gtk_widget_show(win);
 
-  gtk_window_set_focus(GTK_WINDOW(win), compline);
+  if(last_history_selected){
+    gtk_entry_select_region(GTK_ENTRY(compline), 0, strlen(gtk_entry_get_text(GTK_ENTRY(compline))));
+  }else{
+    gtk_entry_set_position(GTK_ENTRY(compline), -1);
+  }
 
   gtk_main();
 }