gtksourceview r2191 - in branches/indenters: . gtksourceview



Author: icq
Date: Sat Feb 28 20:42:22 2009
New Revision: 2191
URL: http://svn.gnome.org/viewvc/gtksourceview?rev=2191&view=rev

Log:
2009-02-28  Ignacio Casal Quinteiro  <nacho resa gmail com>

        * gtksourceview/c-indenter.c:
        Set amount to 0 if we are in a function declaration.



Modified:
   branches/indenters/ChangeLog
   branches/indenters/gtksourceview/c-indenter.c

Modified: branches/indenters/gtksourceview/c-indenter.c
==============================================================================
--- branches/indenters/gtksourceview/c-indenter.c	(original)
+++ branches/indenters/gtksourceview/c-indenter.c	Sat Feb 28 20:42:22 2009
@@ -100,8 +100,6 @@
 	
 	while (case_label[i] != '\0')
 	{
-		g_warning ("%c|%c", c, case_label[i]);
-		
 		if (case_label[i] != c)
 		{
 			is_case = FALSE;
@@ -317,22 +315,36 @@
 	else
 	{
 		GtkTextIter copy;
-		gunichar ch;
 		
 		amount = gtk_source_indenter_get_amount_indents (view, &iter);
 		
-		/*
-		 * Now we have to check for the start of the line
-		 */
 		copy = iter;
 		
-		gtk_source_indenter_move_to_no_space (&copy, 1);
-		ch = gtk_text_iter_get_char (&copy);
-		
-		/* # is always indent 0. Example: #ifdef */
-		if (relocating && ch == '#')
+		/*
+		 * We tried all cases, so now look if we are at the end of a
+		 * func declaration
+		 */
+		if (c == ')')
 		{
-			amount = 0;
+			if (gtk_source_indenter_find_open_char (&copy, '(', ')',
+								FALSE))
+			{
+				amount = gtk_source_indenter_get_amount_indents (view,
+										 &copy);
+			}
+		}
+		else
+		{
+			gunichar ch;
+			
+			gtk_source_indenter_move_to_no_space (&copy, 1);
+			ch = gtk_text_iter_get_char (&copy);
+		
+			/* # is always indent 0. Example: #ifdef */
+			if (relocating && ch == '#')
+			{
+				amount = 0;
+			}
 		}
 	}
 	



[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]