SF.net SVN: geany:[4379] trunk

ntrel at users.sourceforge.net ntrel at xxxxx
Tue Oct 27 15:38:40 UTC 2009


Revision: 4379
          http://geany.svn.sourceforge.net/geany/?rev=4379&view=rev
Author:   ntrel
Date:     2009-10-27 15:38:40 +0000 (Tue, 27 Oct 2009)

Log Message:
-----------
Fix using tab to autocomplete in some other situations that word part
completion doesn't apply in.

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

Modified: trunk/ChangeLog
===================================================================
--- trunk/ChangeLog	2009-10-27 14:59:46 UTC (rev 4378)
+++ trunk/ChangeLog	2009-10-27 15:38:40 UTC (rev 4379)
@@ -10,6 +10,9 @@
  * src/prefs.c, src/ui_utils.c, doc/geany.txt, doc/geany.html:
    Enable switching the sidebar to the right on Windows again, as it
    apparently works after all.
+ * src/editor.c:
+   Fix using tab to autocomplete in some other situations that word part
+   completion doesn't apply in.
 
 
 2009-10-26  Enrico Tröger  <enrico(dot)troeger(at)uvena(dot)de>

Modified: trunk/src/editor.c
===================================================================
--- trunk/src/editor.c	2009-10-27 14:59:46 UTC (rev 4378)
+++ trunk/src/editor.c	2009-10-27 15:38:40 UTC (rev 4379)
@@ -777,16 +777,16 @@
 
 
 /* Complete the next word part from @a entry */
-static void check_partial_completion(GeanyEditor *editor, const gchar *entry)
+static gboolean check_partial_completion(GeanyEditor *editor, const gchar *entry)
 {
 	gchar *stem, *ptr, *text = utils_strdupa(entry);
 
 	read_current_word(editor, -1, current_word, sizeof current_word, NULL, TRUE);
 	stem = current_word;
 	if (strstr(text, stem) != text)
-		return;	/* shouldn't happen */
+		return FALSE;	/* shouldn't happen */
 	if (strlen(text) <= strlen(stem))
-		return;
+		return FALSE;
 
 	text += strlen(stem); /* skip stem */
 	ptr = strstr(text + 1, "_");
@@ -794,7 +794,7 @@
 	{
 		ptr[1] = '\0';
 		partial_complete(editor->sci, text);
-		return;
+		return TRUE;
 	}
 	else
 	{
@@ -807,12 +807,11 @@
 			{
 				ptr[0] = '\0';
 				partial_complete(editor->sci, text);
-				return;
+				return TRUE;
 			}
 		}
 	}
-	/* no word part, complete normally */
-	SSM(editor->sci, SCI_AUTOCCOMPLETE, 0, 0);
+	return FALSE;
 }
 
 
@@ -4791,7 +4790,11 @@
 		return FALSE;
 
 	entry = sci_get_string(editor->sci, SCI_AUTOCGETCURRENTTEXT);
-	check_partial_completion(editor, entry);
+
+	/* if no word part, complete normally */
+	if (!check_partial_completion(editor, entry))
+		SSM(editor->sci, SCI_AUTOCCOMPLETE, 0, 0);
+
 	g_free(entry);
 	return TRUE;
 }


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