SF.net SVN: geany:[3407] trunk

ntrel at users.sourceforge.net ntrel at xxxxx
Fri Dec 19 17:15:53 UTC 2008


Revision: 3407
          http://geany.svn.sourceforge.net/geany/?rev=3407&view=rev
Author:   ntrel
Date:     2008-12-19 17:15:52 +0000 (Fri, 19 Dec 2008)

Log Message:
-----------
Allow Find Usage for selections even when the cursor is not at a
word character.

Modified Paths:
--------------
    trunk/ChangeLog
    trunk/src/editor.c
    trunk/src/keybindings.c
    trunk/src/search.c

Modified: trunk/ChangeLog
===================================================================
--- trunk/ChangeLog	2008-12-19 16:49:37 UTC (rev 3406)
+++ trunk/ChangeLog	2008-12-19 17:15:52 UTC (rev 3407)
@@ -5,6 +5,9 @@
    Fix Fortran Types showing as Interfaces in the symbol list.
  * src/symbols.c:
    Show Structs separately from Typedefs / Enums for the C symbol list.
+ * src/keybindings.c, src/search.c, src/editor.c:
+   Allow Find Usage for selections even when the cursor is not at a
+   word character.
 
 
 2008-12-18  Enrico Tröger  <enrico(dot)troeger(at)uvena(dot)de>

Modified: trunk/src/editor.c
===================================================================
--- trunk/src/editor.c	2008-12-19 16:49:37 UTC (rev 3406)
+++ trunk/src/editor.c	2008-12-19 17:15:52 UTC (rev 3407)
@@ -218,10 +218,13 @@
 	/* calls the edit popup menu in the editor */
 	if (event->button == 3)
 	{
+		gboolean can_goto;
+
 		editor_find_current_word(editor, editor_info.click_pos,
 			current_word, sizeof current_word, NULL);
 
-		ui_update_popup_goto_items((current_word[0] != '\0') ? TRUE : FALSE);
+		can_goto = sci_has_selection(editor->sci) || NZV(current_word);
+		ui_update_popup_goto_items(can_goto);
 		ui_update_popup_copy_items(doc);
 		ui_update_insert_include_item(doc, 0);
 

Modified: trunk/src/keybindings.c
===================================================================
--- trunk/src/keybindings.c	2008-12-19 16:49:37 UTC (rev 3406)
+++ trunk/src/keybindings.c	2008-12-19 17:15:52 UTC (rev 3407)
@@ -59,6 +59,7 @@
 
 
 static gboolean check_current_word(void);
+static gboolean read_current_word(void);
 
 static void cb_func_file_action(guint key_id);
 static void cb_func_project_action(guint key_id);
@@ -1098,12 +1099,12 @@
 		case GEANY_KEYS_SEARCH_PREVIOUSMESSAGE:
 			on_previous_message1_activate(NULL, NULL); break;
 		case GEANY_KEYS_SEARCH_FINDUSAGE:
-			if (check_current_word())
-				on_find_usage1_activate(NULL, NULL);
+			read_current_word();
+			on_find_usage1_activate(NULL, NULL);
 			break;
 		case GEANY_KEYS_SEARCH_FINDDOCUMENTUSAGE:
-			if (check_current_word())
-				on_find_document_usage1_activate(NULL, NULL);
+			read_current_word();
+			on_find_document_usage1_activate(NULL, NULL);
 			break;
 	}
 }
@@ -1193,7 +1194,8 @@
 		gtk_menu_item_activate(GTK_MENU_ITEM(item));
 }
 
-static gboolean check_current_word(void)
+
+static gboolean read_current_word(void)
 {
 	gint pos;
 	GeanyDocument *doc = document_get_current();
@@ -1206,7 +1208,13 @@
 	editor_find_current_word(doc->editor, pos,
 		editor_info.current_word, GEANY_MAX_WORD_LENGTH, NULL);
 
-	if (*editor_info.current_word == 0)
+	return (*editor_info.current_word != 0);
+}
+
+
+static gboolean check_current_word(void)
+{
+	if (!read_current_word())
 	{
 		utils_beep();
 		return FALSE;

Modified: trunk/src/search.c
===================================================================
--- trunk/src/search.c	2008-12-19 16:49:37 UTC (rev 3406)
+++ trunk/src/search.c	2008-12-19 17:15:52 UTC (rev 3407)
@@ -1578,6 +1578,12 @@
 	doc = document_get_current();
 	g_return_if_fail(doc != NULL);
 
+	if (!NZV(search_text))
+	{
+		utils_beep();
+		return;
+	}
+
 	gtk_notebook_set_current_page(GTK_NOTEBOOK(msgwindow.notebook), MSG_MESSAGE);
 	gtk_list_store_clear(msgwindow.store_msg);
 


This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.



More information about the Commits mailing list