SF.net SVN: geany:[4840] trunk

eht16 at users.sourceforge.net eht16 at xxxxx
Mon Apr 19 20:42:44 UTC 2010


Revision: 4840
          http://geany.svn.sourceforge.net/geany/?rev=4840&view=rev
Author:   eht16
Date:     2010-04-19 20:42:44 +0000 (Mon, 19 Apr 2010)

Log Message:
-----------
Add a static global variable to monitor autocompletion mode in order to prevent cancellation of the struct/class (C/C++) auto completion list (patch by Thomas Martitz, thanks).

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

Modified: trunk/ChangeLog
===================================================================
--- trunk/ChangeLog	2010-04-19 20:42:34 UTC (rev 4839)
+++ trunk/ChangeLog	2010-04-19 20:42:44 UTC (rev 4840)
@@ -6,6 +6,10 @@
  * src/sidebar.c:
    Automatically show and hide the sidebar notebook tabs according
    to the amount of visible pages (patch by Adrian Dimitrov, thanks).
+ * src/editor.c:
+   Add a static global variable to monitor autocompletion mode in order
+   to prevent cancellation of the struct/class (C/C++) auto completion
+   list (patch by Thomas Martitz, thanks).
 
 
 2010-04-19  Nick Treleaven  <nick(dot)treleaven(at)btinternet(dot)com>

Modified: trunk/src/editor.c
===================================================================
--- trunk/src/editor.c	2010-04-19 20:42:34 UTC (rev 4839)
+++ trunk/src/editor.c	2010-04-19 20:42:44 UTC (rev 4840)
@@ -88,6 +88,14 @@
 	ScintillaObject *sci;
 } calltip = {NULL, FALSE, NULL, 0, 0, NULL};
 
+static enum
+{
+	AUTOC_CANCELLED,
+	AUTOC_SCOPE,
+	AUTOC_TAGS,
+	AUTOC_DOC_WORDS,
+} autocompletion_mode = AUTOC_CANCELLED;
+
 static gchar indent[100];
 
 
@@ -597,7 +605,10 @@
 		tags = tm_workspace_find_scope_members(obj ? obj->tags_array : NULL,
 			name, TRUE, FALSE);
 		if (tags)
+		{
+			autocompletion_mode = AUTOC_SCOPE;
 			show_tags_list(editor, tags, 0);
+		}
 	}
 }
 
@@ -932,6 +943,7 @@
 		case SCN_AUTOCCANCELLED:
 			/* now that autocomplete is finishing or was cancelled, reshow calltips
 			 * if they were showing */
+			autocompletion_mode = AUTOC_CANCELLED;
 			request_reshowing_calltip(nt);
 			break;
 
@@ -1775,6 +1787,7 @@
 	tags = tm_workspace_find(root, tm_tag_max_t, attrs, TRUE, doc->file_type->lang);
 	if (tags)
 	{
+		autocompletion_mode = AUTOC_TAGS;
 		show_tags_list(editor, tags, rootlen);
 		return tags->len > 0;
 	}
@@ -1884,6 +1897,7 @@
 	if (!words)
 	{
 		scintilla_send_message(sci, SCI_AUTOCCANCEL, 0, 0);
+		autocompletion_mode = AUTOC_CANCELLED;
 		return FALSE;
 	}
 
@@ -1913,6 +1927,7 @@
 	g_slist_free(list);
 	g_string_free(words, TRUE);
 
+	autocompletion_mode = AUTOC_DOC_WORDS;
 	show_autocomplete(sci, rootlen, str->str);
 	g_string_free(str, TRUE);
 	return TRUE;
@@ -1972,7 +1987,7 @@
 	root = linebuf + startword;
 	rootlen = current - startword;
 
-	if (rootlen > 0)
+	if (rootlen > 0 && autocompletion_mode != AUTOC_SCOPE)
 	{
 		if (autocomplete_check_for_html(ft->id, style))
 		{


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