SF.net SVN: geany: [488] trunk

eht16 at users.sourceforge.net eht16 at xxxxx
Mon Jun 26 16:18:03 UTC 2006


Revision: 488
Author:   eht16
Date:     2006-06-26 09:17:57 -0700 (Mon, 26 Jun 2006)
ViewCVS:  http://svn.sourceforge.net/geany/?rev=488&view=rev

Log Message:
-----------
Fixed broken auto completion for switch().

Modified Paths:
--------------
    trunk/ChangeLog
    trunk/src/sci_cb.c
Modified: trunk/ChangeLog
===================================================================
--- trunk/ChangeLog	2006-06-26 15:49:07 UTC (rev 487)
+++ trunk/ChangeLog	2006-06-26 16:17:57 UTC (rev 488)
@@ -1,3 +1,8 @@
+2006-06-26  Enrico Troeger  <enrico.troeger at uvena.de>
+
+ * src/sci_cb.c: Fixed broken auto completion for switch().
+
+
 2006-06-26  Nick Treleaven  <nick.treleaven at btinternet.com>
 
  * src/document.c: Fix a possible segfault on quitting caused by

Modified: trunk/src/sci_cb.c
===================================================================
--- trunk/src/sci_cb.c	2006-06-26 15:49:07 UTC (rev 487)
+++ trunk/src/sci_cb.c	2006-06-26 16:17:57 UTC (rev 488)
@@ -535,7 +535,7 @@
 
 void sci_cb_auto_forif(ScintillaObject *sci, gint pos, gint idx)
 {
-	static gchar buf[7];
+	static gchar buf[8];
 	gchar *eol;
 	gchar *construct;
 	gint lexer = SSM(sci, SCI_GETLEXER, 0, 0);
@@ -568,11 +568,11 @@
 	// get the indention
 	if (doc_list[idx].use_auto_indention) sci_cb_get_indent(sci, pos, TRUE);
 	eol = g_strconcat(utils_get_eol_char(idx), indent, NULL);
-	sci_get_text_range(sci, pos - 7, pos - 1, buf);
-	// "pattern", buf + x, y -> x + y = 6, because buf is (pos - 7)...(pos - 1) = 6
-	if (! strncmp("if", buf + 4, 2))
+	sci_get_text_range(sci, pos - 8, pos - 1, buf);
+	// "pattern", buf + x, y -> x + y = 7, because buf is (pos - 8)...(pos - 1) = 7
+	if (! strncmp("if", buf + 5, 2))
 	{
-		if (! isspace(*(buf + 3))) goto free_and_return;
+		if (! isspace(*(buf + 4))) goto free_and_return;
 
 		construct = g_strdup_printf("()%s{%s\t%s}%s", eol, eol, eol, eol);
 
@@ -580,9 +580,9 @@
 		sci_goto_pos(sci, pos + 1, TRUE);
 		g_free(construct);
 	}
-	else if (! strncmp("else", buf + 2, 4))
+	else if (! strncmp("else", buf + 3, 4))
 	{
-		if (! isspace(*(buf + 1))) goto free_and_return;
+		if (! isspace(*(buf + 2))) goto free_and_return;
 
 		construct = g_strdup_printf("%s{%s\t%s}%s", eol, eol, eol, eol);
 
@@ -590,12 +590,12 @@
 		sci_goto_pos(sci, pos + 4 + (2 * strlen(indent)), TRUE);
 		g_free(construct);
 	}
-	else if (! strncmp("for", buf + 3, 3))
+	else if (! strncmp("for", buf + 4, 3))
 	{
 		gchar *var;
 		gint contruct_len;
 
-		if (! isspace(*(buf + 2))) goto free_and_return;
+		if (! isspace(*(buf + 3))) goto free_and_return;
 
 		if (doc_list[idx].file_type->id == GEANY_FILETYPES_PHP)
 		{
@@ -619,9 +619,9 @@
 		g_free(var);
 		g_free(construct);
 	}
-	else if (! strncmp("while", buf + 1, 5))
+	else if (! strncmp("while", buf + 2, 5))
 	{
-		if (! isspace(*buf)) goto free_and_return;
+		if (! isspace(*buf + 1)) goto free_and_return;
 
 		construct = g_strdup_printf("()%s{%s\t%s}%s", eol, eol, eol, eol);
 
@@ -629,9 +629,9 @@
 		sci_goto_pos(sci, pos + 1, TRUE);
 		g_free(construct);
 	}
-	else if (! strncmp("do", buf + 4, 2))
+	else if (! strncmp("do", buf + 5, 2))
 	{
-		if (! isspace(*(buf + 3))) goto free_and_return;
+		if (! isspace(*(buf + 4))) goto free_and_return;
 
 		construct = g_strdup_printf("%s{%s\t%s}%swhile ();%s", eol, eol, eol, eol, eol);
 
@@ -639,9 +639,9 @@
 		sci_goto_pos(sci, pos + 4 + (2 * strlen(indent)), TRUE);
 		g_free(construct);
 	}
-	else if (! strncmp("try", buf + 3, 3))
+	else if (! strncmp("try", buf + 4, 3))
 	{
-		if (! isspace(*(buf + 2))) goto free_and_return;
+		if (! isspace(*(buf + 3))) goto free_and_return;
 
 		construct = g_strdup_printf("%s{%s\t%s}%scatch ()%s{%s\t%s}%s",
 							eol, eol, eol, eol, eol, eol, eol, eol);
@@ -650,9 +650,9 @@
 		sci_goto_pos(sci, pos + 4 + (2 * strlen(indent)), TRUE);
 		g_free(construct);
 	}
-	else if (! strncmp("switch", buf, 5))
+	else if (! strncmp("switch", buf + 1, 6))
 	{
-		if (! isspace(*(buf + 4))) goto free_and_return;
+		if (! isspace(*buf)) goto free_and_return;
 
 		construct = g_strdup_printf("()%s{%s\tcase : break;%s\tdefault: %s}%s", eol, eol, eol, eol, eol);
 


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