SF.net SVN: geany:[3730] trunk

eht16 at users.sourceforge.net eht16 at xxxxx
Fri Apr 24 19:29:45 UTC 2009


Revision: 3730
          http://geany.svn.sourceforge.net/geany/?rev=3730&view=rev
Author:   eht16
Date:     2009-04-24 19:29:45 +0000 (Fri, 24 Apr 2009)

Log Message:
-----------
When the editor menu is opened by the Menu key, use the text cursor position for retrieving the current word. This fixes disabled Go to Tag items in the menu (#2780044).

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

Modified: trunk/ChangeLog
===================================================================
--- trunk/ChangeLog	2009-04-24 19:29:20 UTC (rev 3729)
+++ trunk/ChangeLog	2009-04-24 19:29:45 UTC (rev 3730)
@@ -6,6 +6,10 @@
  * src/document.c:
    Fix a crash when USE_GIO_FILEMON is enabled at closing a document
    which was reloaded shortly before.
+ * src/editor.c:
+   When the editor menu is opened by the Menu key, use the text cursor
+   position for retrieving the current word. This fixes disabled
+   Go to Tag items in the menu (#2780044).
 
 
 2009-04-21  Enrico Tröger  <enrico(dot)troeger(at)uvena(dot)de>

Modified: trunk/src/editor.c
===================================================================
--- trunk/src/editor.c	2009-04-24 19:29:20 UTC (rev 3729)
+++ trunk/src/editor.c	2009-04-24 19:29:45 UTC (rev 3730)
@@ -199,8 +199,15 @@
 	GeanyEditor *editor = data;
 	GeanyDocument *doc = editor->document;
 
-	editor_info.click_pos = sci_get_position_from_xy(editor->sci,
-		(gint)event->x, (gint)event->y, FALSE);
+	/* it's very unlikely we got a 'real' click even on 0, 0, so assume it is a
+	 * fake event to show the editor menu triggered by a key event where we want to use the
+	 * text cursor position. */
+	if (event->x > 0.0 && event->y > 0.0)
+		editor_info.click_pos = sci_get_position_from_xy(editor->sci,
+			(gint)event->x, (gint)event->y, FALSE);
+	else
+		editor_info.click_pos = sci_get_current_position(editor->sci);
+
 	if (event->button == 1)
 	{
 		guint state = event->state & gtk_accelerator_get_default_mod_mask();


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