gtksourceview r2134 - branches/gnome-2-24/gtksourceview



Author: pborelli
Date: Sat Jan 10 18:11:05 2009
New Revision: 2134
URL: http://svn.gnome.org/viewvc/gtksourceview?rev=2134&view=rev

Log:
backport context engine bugfix


Modified:
   branches/gnome-2-24/gtksourceview/gtksourcecontextengine.c

Modified: branches/gnome-2-24/gtksourceview/gtksourcecontextengine.c
==============================================================================
--- branches/gnome-2-24/gtksourceview/gtksourcecontextengine.c	(original)
+++ branches/gnome-2-24/gtksourceview/gtksourcecontextengine.c	Sat Jan 10 18:11:05 2009
@@ -1670,10 +1670,24 @@
 					 gint             start_offset,
 					 gint             end_offset)
 {
+	GtkTextIter iter;
+	GtkSourceContextEngine *ce = GTK_SOURCE_CONTEXT_ENGINE (engine);
+
 	g_return_if_fail (start_offset < end_offset);
-	invalidate_region (GTK_SOURCE_CONTEXT_ENGINE (engine),
-			   start_offset,
-			   end_offset - start_offset);
+
+	invalidate_region (ce, start_offset, end_offset - start_offset);
+
+	/* If end_offset is at the start of a line (enter key pressed) then
+	 * we need to invalidate the whole new line, otherwise it may not be
+	 * highlighted because the engine analyzes the previous line, end
+	 * context there is none, start context at this line is none too,
+	 * and the engine stops. */
+	gtk_text_buffer_get_iter_at_offset (ce->priv->buffer, &iter, end_offset);
+	if (gtk_text_iter_starts_line (&iter) && !gtk_text_iter_ends_line (&iter))
+	{
+		gtk_text_iter_forward_to_line_end (&iter);
+		invalidate_region (ce, gtk_text_iter_get_offset (&iter), 0);
+	}
 }
 
 /**



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