anjuta r3652 - in trunk: . plugins/language-support-cpp-java plugins/sourceview



Author: jhs
Date: Wed Feb 13 21:14:58 2008
New Revision: 3652
URL: http://svn.gnome.org/viewvc/anjuta?rev=3652&view=rev

Log:
2008-02-13  Johannes Schmid <jhs gnome org>

	* plugins/language-support-cpp-java/plugin.c:
	(is_iter_inside_string), (get_line_auto_indentation):
	Handle comments in the code and do not ask editor. Fixes scintilla
	indentation (sourceview does not report comments anyway).
	
	* plugins/sourceview/sourceview-cell.c: (iiter_diff):
	Diff with correct sign (also fixes some issues with language-support)

Modified:
   trunk/ChangeLog
   trunk/plugins/language-support-cpp-java/plugin.c
   trunk/plugins/sourceview/sourceview-cell.c

Modified: trunk/plugins/language-support-cpp-java/plugin.c
==============================================================================
--- trunk/plugins/language-support-cpp-java/plugin.c	(original)
+++ trunk/plugins/language-support-cpp-java/plugin.c	Wed Feb 13 21:14:58 2008
@@ -916,7 +916,7 @@
 			 * statement could hardly be incomplte.
 			 */
 			if (point_ch == '}' && *incomplete_statement == -1)
-			  *incomplete_statement = 0;
+				*incomplete_statement = 0;
 			
 			/* If at level 0 indentation, encoutered a
 			 * block end, don't bother going further
@@ -1110,42 +1110,40 @@
 	return line_indent;
 }
 
-/* Check if iter is inside comment or string. Begining of comment or string
+/* Check if iter is inside string. Begining of string
  * is not counted as inside.
  */
 static gboolean
-is_iter_inside_comment_or_string (IAnjutaIterable *iter)
+is_iter_inside_string (IAnjutaIterable *iter)
 {
 	IAnjutaEditorAttribute attrib;
 	
 	attrib = ianjuta_editor_cell_get_attribute (IANJUTA_EDITOR_CELL (iter),
 												NULL);
-	/* Check if we are *inside* comment or string. Begining of comment
-	 * or string does not count as inside.
+	/* Check if we are *inside* string. Begining
+	 * of string does not count as inside.
 	 */
-	if (attrib == IANJUTA_EDITOR_COMMENT || attrib == IANJUTA_EDITOR_STRING)
+	if (attrib == IANJUTA_EDITOR_STRING)
 	{
 		/* Peek previous attrib and see what it was */
 		if (ianjuta_iterable_previous (iter, NULL))
 		{
 			attrib = ianjuta_editor_cell_get_attribute (IANJUTA_EDITOR_CELL
 														(iter),	NULL);
-			if (attrib == IANJUTA_EDITOR_COMMENT ||
-				attrib == IANJUTA_EDITOR_STRING)
+			if (attrib == IANJUTA_EDITOR_STRING)
 			{
-				/* We are inside comment or string */
+				/* We are inside string */
 				return TRUE;
 			}
 			else
 			{
-				/* The comment or string just began, not inside.
+				/* The string just began, not inside.
 				 * Restore iter from the peek
 				 */
 				ianjuta_iterable_next (iter, NULL);
 			}
 		}
-		/* else, there is no previous and so we can't be inside comment
-		 * or string
+		/* else, there is no previous and so we can't be inside string
 		 */
 	}
 	return FALSE;
@@ -1166,7 +1164,7 @@
 	
 	iter = ianjuta_editor_get_line_begin_position (editor, line, NULL);
 	
-	if (is_iter_inside_comment_or_string (iter))
+	if (is_iter_inside_string (iter))
 	{
 		line_indent = get_line_indentation (editor, line - 1);
 	}
@@ -1184,7 +1182,7 @@
 		 * or string does not count as inside. If inside, just align with
 		 * previous indentation.
 		 */
-		if (is_iter_inside_comment_or_string (iter))
+		if (is_iter_inside_string (iter))
 		{
 			line_indent = get_line_indentation (editor, line - 1);
 			break;

Modified: trunk/plugins/sourceview/sourceview-cell.c
==============================================================================
--- trunk/plugins/sourceview/sourceview-cell.c	(original)
+++ trunk/plugins/sourceview/sourceview-cell.c	Wed Feb 13 21:14:58 2008
@@ -298,8 +298,8 @@
 {
 	SourceviewCell* cell = SOURCEVIEW_CELL(iter);
 	SourceviewCell* other_cell = SOURCEVIEW_CELL(other_iter);
-	return (gtk_text_iter_get_offset (cell->priv->iter) 
-					- gtk_text_iter_get_offset (other_cell->priv->iter));
+	return (gtk_text_iter_get_offset (other_cell->priv->iter) 
+					- gtk_text_iter_get_offset (cell->priv->iter));
 }
 
 static void



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