SF.net SVN: geany: [414] trunk

ntrel at users.sourceforge.net ntrel at xxxxx
Mon Jun 5 22:04:59 UTC 2006


Revision: 414
Author:   ntrel
Date:     2006-06-05 15:04:50 -0700 (Mon, 05 Jun 2006)
ViewCVS:  http://svn.sourceforge.net/geany/?rev=414&view=rev

Log Message:
-----------
Fix empty white box glitch with tag autocompletion, also improves typing response efficiency

Modified Paths:
--------------
    trunk/ChangeLog
    trunk/src/sci_cb.c
Modified: trunk/ChangeLog
===================================================================
--- trunk/ChangeLog	2006-06-05 17:39:58 UTC (rev 413)
+++ trunk/ChangeLog	2006-06-05 22:04:50 UTC (rev 414)
@@ -1,6 +1,8 @@
 2006-06-05  Nick Treleaven  <nick.treleaven at btinternet.com>
 
  * doc/geany.docbook: Added save current file behaviour when building.
+ * src/sci_cb.c: Fix empty white box glitch with tag autocompletion,
+				 also improves typing response efficiency.
 
 
 2006-06-05  Enrico Troeger  <enrico.troeger at uvena.de>

Modified: trunk/src/sci_cb.c
===================================================================
--- trunk/src/sci_cb.c	2006-06-05 17:39:58 UTC (rev 413)
+++ trunk/src/sci_cb.c	2006-06-05 22:04:50 UTC (rev 414)
@@ -398,7 +398,6 @@
 	gint line_start = sci_get_position_from_line(sci, line);
 	gint line_len = sci_get_line_length(sci, line);
 	gint line_pos = pos - line_start - 1;
-	gint i = 0;
 	gint current = pos - line_start;
 	gint rootlen;
 	gint startword = current, lexer = SSM(sci, SCI_GETLEXER, 0, 0);
@@ -407,14 +406,15 @@
 	gchar *root;
 	const GPtrArray *tags;
 
-	sci_get_line(sci, line, linebuf);
-
 	//if (lexer != SCLEX_CPP && lexer != SCLEX_HTML && lexer != SCLEX_PASCAL) return FALSE;
 	if (lexer == SCLEX_HTML && style == SCE_H_DEFAULT) return FALSE;
 	if (lexer == SCLEX_CPP && (style == SCE_C_COMMENT ||
 			style == SCE_C_COMMENTLINE || style == SCE_C_COMMENTDOC)) return FALSE;
 
-	while ((startword > 0) && (strchr(GEANY_WORDCHARS, linebuf[startword - 1]) || strchr(GEANY_WORDCHARS, linebuf[startword - 1])))
+	sci_get_line(sci, line, linebuf);
+
+	// find the start of the current word
+	while ((startword > 0) && (strchr(GEANY_WORDCHARS, linebuf[startword - 1])))
 		startword--;
 	linebuf[current] = '\0';
 	root = linebuf + startword;
@@ -440,11 +440,13 @@
 	}
 	else
 	{	// C and C++ tag autocompletion
-		while (! g_ascii_isspace(linebuf[line_pos - i])) i++;
+		gint i = 0;
+
+		while ((line_pos - i >= 0) && ! g_ascii_isspace(linebuf[line_pos - i])) i++;
 		if (i < 4) return FALSE;	// go home if typed less than 4 chars
 
 		tags = tm_workspace_find(root, tm_tag_max_t, NULL, TRUE);
-		if (NULL != tags)
+		if (NULL != tags && tags->len > 0)
 		{
 			GString *words = g_string_sized_new(150);
 			TMTag *tag;


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