? gtksourceview-zip
? hlline.patch
? hlline2.patch
? hlline3.patch
? po/stamp-it
Index: docs/reference/tmpl/buffer.sgml
===================================================================
RCS file: /cvs/gnome/gtksourceview/docs/reference/tmpl/buffer.sgml,v
retrieving revision 1.5
diff -u -p -r1.5 buffer.sgml
--- docs/reference/tmpl/buffer.sgml	8 Mar 2005 10:47:58 -0000	1.5
+++ docs/reference/tmpl/buffer.sgml	16 Jan 2006 10:25:12 -0000
@@ -108,6 +108,16 @@ one for the old location and one for the
 
 </para>
 
+<!-- ##### ARG GtkSourceBuffer:highlight-current-line ##### -->
+<para>
+
+</para>
+
+<!-- ##### ARG GtkSourceBuffer:highlight-current-line-color ##### -->
+<para>
+
+</para>
+
 <!-- ##### ARG GtkSourceBuffer:language ##### -->
 <para>
 
Index: docs/reference/tmpl/gtksourceview-unused.sgml
===================================================================
RCS file: /cvs/gnome/gtksourceview/docs/reference/tmpl/gtksourceview-unused.sgml,v
retrieving revision 1.3
diff -u -p -r1.3 gtksourceview-unused.sgml
--- docs/reference/tmpl/gtksourceview-unused.sgml	13 Oct 2004 09:16:11 -0000	1.3
+++ docs/reference/tmpl/gtksourceview-unused.sgml	16 Jan 2006 10:25:12 -0000
@@ -86,6 +86,12 @@
 </para>
 
 
+<!-- ##### ARG GtkSourceView:highlight-line-color ##### -->
+<para>
+
+</para>
+
+
 <!-- ##### FUNCTION gtk_pattern_tag_get_type ##### -->
 <para>
 
Index: gtksourceview/gtksourcebuffer.c
===================================================================
RCS file: /cvs/gnome/gtksourceview/gtksourceview/gtksourcebuffer.c,v
retrieving revision 1.45
diff -u -p -r1.45 gtksourcebuffer.c
--- gtksourceview/gtksourcebuffer.c	11 Jan 2006 15:03:48 -0000	1.45
+++ gtksourceview/gtksourcebuffer.c	16 Jan 2006 10:25:13 -0000
@@ -71,6 +71,8 @@
 
 #define MAX_CHARS_BEFORE_FINDING_A_MATCH    2000
 
+#define HIGHLIGHT_LINE                      "GtkSourceBuffer:HighlightLine"
+
 typedef struct _SyntaxDelimiter      SyntaxDelimiter;
 typedef struct _PatternMatch         PatternMatch;
 
@@ -89,6 +91,8 @@ enum {
 	PROP_ESCAPE_CHAR,
 	PROP_CHECK_BRACKETS,
 	PROP_HIGHLIGHT,
+	PROP_HIGHLIGHT_CURRENT_LINE,
+	PROP_HIGHLIGHT_CURRENT_LINE_COLOR,
 	PROP_MAX_UNDO_LEVELS,
 	PROP_LANGUAGE
 };
@@ -109,8 +113,12 @@ struct _PatternMatch
 struct _GtkSourceBufferPrivate 
 {
 	gint                   highlight:1;
+	gint                   highlight_current_line:1;
 	gint                   check_brackets:1;
 
+	GdkColor              *highlight_current_line_color;
+	GtkTextTag            *hl_line_tag;
+
 	GtkTextTag            *bracket_match_tag;
 	GtkTextMark           *bracket_mark;
 	guint                  bracket_found:1;
@@ -299,6 +307,41 @@ gtk_source_buffer_class_init (GtkSourceB
 							       FALSE,
 							       G_PARAM_READWRITE));
 	
+	/**
+	 * GtkSourceBuffer:highlight_current_line:
+	 *
+	 * The ::highlight_current_line property determines whether the current
+	 * line (where the cursor is located) will be highlighted.
+	 *
+	 * Since: 1.6
+	 */
+	g_object_class_install_property (object_class,
+					 PROP_HIGHLIGHT_CURRENT_LINE,
+					 g_param_spec_boolean ("highlight_current_line",
+							       _("Highlight Current Line"),
+							       _("Whether to highlight the "
+								 "active line in the buffer"),
+							       FALSE,
+							       G_PARAM_READWRITE));
+	
+	/**
+	 * GtkSourceBuffer:highlight_current_line_color:
+	 *
+	 * The ::highlight_current_line_color property contains the color with
+	 * which the current line (where the cursor is located) will be
+	 * highlighted.
+	 *
+	 * Since: 1.6
+	 */
+	g_object_class_install_property (object_class,
+					 PROP_HIGHLIGHT_CURRENT_LINE_COLOR,
+					 g_param_spec_boxed ("highlight_current_line_color",
+							     _("Highlight Current Line Color"),
+							     _("The color used to highlight the "
+							       "active line in the buffer"),
+							     GDK_TYPE_COLOR,
+							     G_PARAM_READWRITE));
+	
 	g_object_class_install_property (object_class,
 					 PROP_MAX_UNDO_LEVELS,
 					 g_param_spec_int ("max_undo_levels",
@@ -374,6 +417,8 @@ gtk_source_buffer_init (GtkSourceBuffer 
 
 	buffer->priv = priv;
 
+	priv->highlight_current_line_color = NULL;
+
 	priv->undo_manager = gtk_source_undo_manager_new (GTK_TEXT_BUFFER (buffer));
 
 	priv->check_brackets = TRUE;
@@ -392,7 +437,7 @@ gtk_source_buffer_init (GtkSourceBuffer 
 	/* initially the buffer is empty so it's entirely analyzed */
 	priv->worker_last_offset = -1;
 	priv->worker_batch_size = INITIAL_WORKER_BATCH;
-	
+
 	g_signal_connect (G_OBJECT (buffer),
 			  "mark_set",
 			  G_CALLBACK (gtk_source_buffer_move_cursor),
@@ -511,6 +556,10 @@ gtk_source_buffer_constructor (GType    
 					  G_CALLBACK (tag_added_or_removed_cb),
 					  source_buffer);				
 		}
+
+		source_buffer->priv->hl_line_tag =
+			gtk_text_buffer_create_tag (GTK_TEXT_BUFFER (source_buffer),
+						    HIGHLIGHT_LINE, NULL);
 	}
 
 	return g_object;
@@ -534,6 +583,9 @@ gtk_source_buffer_finalize (GObject *obj
 	if (buffer->priv->worker_handler) {
 		g_source_remove (buffer->priv->worker_handler);
 	}
+	
+	if (buffer->priv->highlight_current_line_color)
+		gdk_color_free (buffer->priv->highlight_current_line_color);
 
 	/* we can't delete marks if we're finalizing the buffer */
 	gtk_text_region_destroy (buffer->priv->refresh_region, FALSE);
@@ -601,6 +653,16 @@ gtk_source_buffer_set_property (GObject 
 							 g_value_get_boolean (value));
 			break;
 			
+		case PROP_HIGHLIGHT_CURRENT_LINE:
+			gtk_source_buffer_set_highlight_current_line (source_buffer,
+								      g_value_get_boolean (value));
+			break;
+			
+		case PROP_HIGHLIGHT_CURRENT_LINE_COLOR:
+			gtk_source_buffer_set_highlight_current_line_color (source_buffer,
+									    g_value_get_boxed (value));
+			break;
+			
 		case PROP_MAX_UNDO_LEVELS:
 			gtk_source_buffer_set_max_undo_levels (source_buffer,
 							       g_value_get_int (value));
@@ -643,6 +705,14 @@ gtk_source_buffer_get_property (GObject 
 			g_value_set_boolean (value, source_buffer->priv->highlight);
 			break;
 			
+		case PROP_HIGHLIGHT_CURRENT_LINE:
+			g_value_set_boolean (value, source_buffer->priv->highlight_current_line);
+			break;
+			
+		case PROP_HIGHLIGHT_CURRENT_LINE_COLOR:
+			g_value_set_boxed (value, source_buffer->priv->highlight_current_line_color);
+			break;
+			
 		case PROP_MAX_UNDO_LEVELS:
 			g_value_set_int (value,
 					 gtk_source_buffer_get_max_undo_levels (source_buffer));
@@ -746,11 +816,96 @@ get_tags_func (GtkTextTag *tag, gpointer
 }
 
 static void
+add_highlight_to_line (GtkTextBuffer *buffer, GtkTextIter *lineiter)
+{
+	GtkTextIter start, end;
+
+	/* When the user has already selected 1 or more lines, those lines are
+	 * already highlighted by GtkTextView. Don't highlight the active line
+	 * in that case. */
+	 
+	/* If an entire line is selected, don't add a highlight. */
+	gtk_text_buffer_get_selection_bounds (buffer, &start, &end);
+	if (!gtk_text_iter_equal (&start, &end) &&
+	    gtk_text_iter_starts_line (&start) &&
+	    gtk_text_iter_ends_line (&end))
+		return;
+	/* Also don't highlight if the selection spans multiple lines. */
+	else if (gtk_text_iter_get_line (&start) != gtk_text_iter_get_line (&end))
+		return;
+
+	start = end = *lineiter;
+	
+	/* Highlight from the start of the current line to the end of the line. */
+	/* If the line is empty, highlight to the start of the next line. */
+	gtk_text_iter_set_line_index (&start, 0);
+	if (!gtk_text_iter_ends_line (&end))
+		gtk_text_iter_forward_to_line_end (&end);
+	else if (gtk_text_iter_starts_line (&end))
+		gtk_text_iter_forward_visible_line (&end);
+
+	gtk_text_buffer_apply_tag_by_name (buffer, HIGHLIGHT_LINE, &start, &end);
+	gtk_text_buffer_move_mark_by_name (buffer, HIGHLIGHT_LINE, &start);
+}
+
+static void
+remove_highlight_from_line (GtkSourceBuffer *buffer, GtkTextIter *lineiter)
+{
+	GtkTextIter start, end;
+
+	start = end = *lineiter;
+
+	gtk_text_iter_set_line_index (&start, 0);
+	gtk_text_iter_forward_to_tag_toggle (&end, buffer->priv->hl_line_tag);
+	
+	gtk_text_buffer_remove_tag_by_name (GTK_TEXT_BUFFER (buffer),
+					    HIGHLIGHT_LINE, &start, &end);
+}
+
+static void
+update_highlighted_line (GtkSourceBuffer *buffer, GtkTextIter *iter, gboolean enable)
+{
+	GtkTextBuffer *text_buffer;
+	GtkTextMark *mark;
+	GtkTextIter hliter;
+
+	text_buffer = GTK_TEXT_BUFFER (buffer);
+	mark = gtk_text_buffer_get_mark (text_buffer, HIGHLIGHT_LINE);
+	
+	if (enable)
+	{
+		if (!mark)
+		{
+			gtk_text_buffer_create_mark (text_buffer, HIGHLIGHT_LINE, iter, FALSE);
+			add_highlight_to_line (text_buffer, iter);
+		}
+		else
+		{
+			gtk_text_buffer_get_iter_at_mark (text_buffer, &hliter, mark);
+
+			/* Check if the current line isn't already highlighted. */
+			if (!gtk_text_iter_has_tag (iter, buffer->priv->hl_line_tag))
+			{
+				remove_highlight_from_line (buffer, &hliter);
+				add_highlight_to_line (text_buffer, iter);
+			}
+		}
+	}
+	else if (mark)
+	{
+		gtk_text_buffer_get_iter_at_mark (text_buffer, &hliter, mark);
+		remove_highlight_from_line (buffer, &hliter);
+		gtk_text_buffer_delete_mark (text_buffer, mark);
+	}
+}
+
+static void
 gtk_source_buffer_move_cursor (GtkTextBuffer *buffer,
 			       GtkTextIter   *iter, 
 			       GtkTextMark   *mark, 
 			       gpointer       data)
 {
+	GtkSourceBuffer *source_buffer;
 	GtkTextIter iter1, iter2;
 
 	g_return_if_fail (GTK_IS_SOURCE_BUFFER (buffer));
@@ -758,50 +913,55 @@ gtk_source_buffer_move_cursor (GtkTextBu
 	g_return_if_fail (mark != NULL);
 	g_return_if_fail (gtk_text_iter_get_buffer (iter) == buffer);
 
+	source_buffer = GTK_SOURCE_BUFFER (buffer);
+
 	if (mark != gtk_text_buffer_get_insert (buffer))
 		return;
 
-	if (GTK_SOURCE_BUFFER (buffer)->priv->bracket_found) 
+	if (source_buffer->priv->highlight_current_line)
+		update_highlighted_line (source_buffer, iter, TRUE);
+
+	if (source_buffer->priv->bracket_found) 
 	{
 		gtk_text_buffer_get_iter_at_mark (buffer,
 						  &iter1,
-						  GTK_SOURCE_BUFFER (buffer)->priv->bracket_mark);
+						  source_buffer->priv->bracket_mark);
 		iter2 = iter1;
 		gtk_text_iter_forward_char (&iter2);
 		gtk_text_buffer_remove_tag (buffer,
-					    GTK_SOURCE_BUFFER (buffer)->priv->bracket_match_tag,
+					    source_buffer->priv->bracket_match_tag,
 					    &iter1, 
 					    &iter2);
 	}
 
-	if (!GTK_SOURCE_BUFFER (buffer)->priv->check_brackets)
+	if (!source_buffer->priv->check_brackets)
 		return;
 
 	iter1 = *iter;
 	if (gtk_source_buffer_find_bracket_match_with_limit (&iter1, MAX_CHARS_BEFORE_FINDING_A_MATCH)) 
 	{
-		if (!GTK_SOURCE_BUFFER (buffer)->priv->bracket_mark)
-			GTK_SOURCE_BUFFER (buffer)->priv->bracket_mark =
+		if (!source_buffer->priv->bracket_mark)
+			source_buffer->priv->bracket_mark =
 				gtk_text_buffer_create_mark (buffer, 
 							     NULL,
 							     &iter1, 
 							     FALSE);
 		else
 			gtk_text_buffer_move_mark (buffer,
-						   GTK_SOURCE_BUFFER (buffer)->priv->bracket_mark,
+						   source_buffer->priv->bracket_mark,
 						   &iter1);
 
 		iter2 = iter1;
 		gtk_text_iter_forward_char (&iter2);
 		gtk_text_buffer_apply_tag (buffer,
-					   GTK_SOURCE_BUFFER (buffer)->priv->bracket_match_tag,
+					   source_buffer->priv->bracket_match_tag,
 					   &iter1, 
 					   &iter2);
-		GTK_SOURCE_BUFFER (buffer)->priv->bracket_found = TRUE;
+		source_buffer->priv->bracket_found = TRUE;
 	}
 	else
 	{
-		GTK_SOURCE_BUFFER (buffer)->priv->bracket_found = FALSE;
+		source_buffer->priv->bracket_found = FALSE;
 	}
 }
 
@@ -1537,6 +1697,90 @@ gtk_source_buffer_set_highlight (GtkSour
 							  &iter2);
 	}
 	g_object_notify (G_OBJECT (buffer), "highlight");
+}
+
+/**
+ * gtk_source_buffer_get_highlight_current_line:
+ * @buffer: a #GtkSourceBuffer
+ *
+ * Returns whether the current line is highlighted
+ *
+ * Return value: TRUE if the current line is highlighted
+ **/
+gboolean 
+gtk_source_buffer_get_highlight_current_line (GtkSourceBuffer *buffer)
+{
+	g_return_val_if_fail (GTK_IS_SOURCE_BUFFER (buffer), FALSE);
+
+	return buffer->priv->highlight_current_line;
+}
+
+/**
+ * gtk_source_buffer_set_highlight_current_line:
+ * @buffer: a #GtkSourceBuffer
+ * @hl: whether to highlight the current line
+ **/
+void 
+gtk_source_buffer_set_highlight_current_line (GtkSourceBuffer *buffer, gboolean hl)
+{
+	GtkTextIter iter;
+
+	g_return_if_fail (GTK_IS_SOURCE_BUFFER (buffer));
+
+	hl = (hl != FALSE);
+
+	if (buffer->priv->highlight_current_line == hl)
+		return;
+
+	buffer->priv->highlight_current_line = hl;
+	
+	gtk_text_buffer_get_iter_at_mark (GTK_TEXT_BUFFER (buffer), &iter,
+					  gtk_text_buffer_get_insert (GTK_TEXT_BUFFER (buffer)));
+	update_highlighted_line (buffer, &iter, hl);
+
+	g_object_notify (G_OBJECT (buffer), "highlight_current_line");
+}
+
+/**
+ * gtk_source_buffer_get_highlight_current_line_color:
+ * @buffer: a #GtkSourceBuffer
+ *
+ * Returns the color with which the current line will be highlighted
+ *
+ * Return value: GdkColor
+ **/
+const GdkColor *
+gtk_source_buffer_get_highlight_current_line_color (GtkSourceBuffer *buffer)
+{
+	g_return_val_if_fail (GTK_IS_SOURCE_BUFFER (buffer), FALSE);
+
+	return buffer->priv->highlight_current_line_color;
+}
+
+/**
+ * gtk_source_buffer_set_highlight_current_line_color:
+ * @buffer: a #GtkSourceBuffer
+ * @color: the background color to be used for highlighting the current line
+ **/
+void
+gtk_source_buffer_set_highlight_current_line_color (GtkSourceBuffer *buffer,
+						    const GdkColor *color)
+{
+	g_return_if_fail (GTK_IS_SOURCE_BUFFER (buffer));
+	g_return_if_fail (color != NULL);
+	
+	if (buffer->priv->highlight_current_line_color != NULL &&
+	    gdk_color_equal (color, buffer->priv->highlight_current_line_color))
+		return;
+	
+	if (buffer->priv->highlight_current_line_color)
+		gdk_color_free (buffer->priv->highlight_current_line_color);
+	buffer->priv->highlight_current_line_color = gdk_color_copy (color);
+	
+	g_object_set (buffer->priv->hl_line_tag, "paragraph-background-gdk",
+		      color, NULL);
+	
+	g_object_notify (G_OBJECT (buffer), "highlight_current_line_color");
 }
 
 /* Idle worker code ------------ */
Index: gtksourceview/gtksourcebuffer.h
===================================================================
RCS file: /cvs/gnome/gtksourceview/gtksourceview/gtksourcebuffer.h,v
retrieving revision 1.18
diff -u -p -r1.18 gtksourcebuffer.h
--- gtksourceview/gtksourcebuffer.h	6 Jun 2003 08:54:36 -0000	1.18
+++ gtksourceview/gtksourcebuffer.h	16 Jan 2006 10:25:13 -0000
@@ -92,6 +92,18 @@ gboolean		 gtk_source_buffer_get_highlig
 void			 gtk_source_buffer_set_highlight	(GtkSourceBuffer        *buffer,
 								 gboolean                highlight);
 
+void			 gtk_source_buffer_set_highlight_current_line 	
+								(GtkSourceBuffer        *buffer,
+								 gboolean                show);
+gboolean		 gtk_source_buffer_get_highlight_current_line 	
+								(GtkSourceBuffer        *buffer);
+
+const GdkColor          *gtk_source_buffer_get_highlight_current_line_color
+								(GtkSourceBuffer        *buffer);
+void			 gtk_source_buffer_set_highlight_current_line_color
+								(GtkSourceBuffer        *buffer,
+								 const GdkColor         *color);
+
 gint			 gtk_source_buffer_get_max_undo_levels	(GtkSourceBuffer        *buffer);
 void			 gtk_source_buffer_set_max_undo_levels	(GtkSourceBuffer        *buffer,
 							    	 gint                    max_undo_levels);
Index: gtksourceview/gtksourceview.c
===================================================================
RCS file: /cvs/gnome/gtksourceview/gtksourceview/gtksourceview.c,v
retrieving revision 1.45
diff -u -p -r1.45 gtksourceview.c
--- gtksourceview/gtksourceview.c	15 Jan 2006 11:30:14 -0000	1.45
+++ gtksourceview/gtksourceview.c	16 Jan 2006 10:25:13 -0000
@@ -69,6 +69,10 @@
 #define DEFAULT_MARGIN			80
 #define MAX_MARGIN			200
 
+#define DEPRECATED_HIGHLIGHT_LINE \
+	"GtkSourceView:highlight_current_line property is deprecated; use " \
+	"GtkSourceBuffer:highlight_current_line instead"
+
 /* Signals */
 enum {
 	UNDO,
@@ -87,7 +91,9 @@ enum {
 	PROP_SHOW_MARGIN,
 	PROP_MARGIN,
 	PROP_SMART_HOME_END,
+#ifndef GTK_SOURCE_VIEW_DISABLE_DEPRECATED
 	PROP_HIGHLIGHT_CURRENT_LINE
+#endif
 };
 
 struct _GtkSourceViewPrivate
@@ -282,6 +288,7 @@ gtk_source_view_class_init (GtkSourceVie
 							       TRUE,
 							       G_PARAM_READWRITE));
 
+#ifndef GTK_SOURCE_VIEW_DISABLE_DEPRECATED
 	g_object_class_install_property (object_class,
 					 PROP_HIGHLIGHT_CURRENT_LINE,
 					 g_param_spec_boolean ("highlight_current_line",
@@ -289,6 +296,7 @@ gtk_source_view_class_init (GtkSourceVie
 							       _("Whether to highlight the current line"),
 							       FALSE,
 							       G_PARAM_READWRITE));
+#endif
 
 	/**
 	 * GtkSourceView:right-margin-line-alpha:
@@ -469,11 +477,24 @@ gtk_source_view_set_property (GObject   
 							    g_value_get_boolean (value));
 			break;
 
+#ifndef GTK_SOURCE_VIEW_DISABLE_DEPRECATED
 		case PROP_HIGHLIGHT_CURRENT_LINE:
-			gtk_source_view_set_highlight_current_line (view,
-								    g_value_get_boolean (value));
+			g_warning (DEPRECATED_HIGHLIGHT_LINE);
+			/* If this property is set from the constructor, there
+			 * is no GtkSourceBuffer yet. In that case, store the
+			 * property and set it in set_source_buffer. */
+			if (view->priv->source_buffer != NULL)
+			{
+				gtk_source_buffer_set_highlight_current_line
+					(view->priv->source_buffer,
+					 g_value_get_boolean (value));
+			}
+			else
+			{
+				view->priv->highlight_current_line = g_value_get_boolean (value);
+			}
 			break;
-
+#endif
 		
 		default:
 			G_OBJECT_WARN_INVALID_PROPERTY_ID (object, prop_id, pspec);
@@ -488,6 +509,7 @@ gtk_source_view_get_property (GObject   
 			      GParamSpec *pspec)
 {
 	GtkSourceView *view;
+	GtkSourceBuffer *buffer;
 	
 	g_return_if_fail (GTK_IS_SOURCE_VIEW (object));
 
@@ -540,9 +562,13 @@ gtk_source_view_get_property (GObject   
 					     gtk_source_view_get_smart_home_end (view));
 			break;
 			
+#ifndef GTK_SOURCE_VIEW_DISABLE_DEPRECATED
 		case PROP_HIGHLIGHT_CURRENT_LINE:
+			g_warning (DEPRECATED_HIGHLIGHT_LINE);
+			buffer = GTK_SOURCE_BUFFER (gtk_text_view_get_buffer (GTK_TEXT_VIEW (view)));
 			g_value_set_boolean (value,
-					     gtk_source_view_get_highlight_current_line (view));
+					     gtk_source_buffer_get_highlight_current_line (buffer));
+#endif
 
 		default:
 			G_OBJECT_WARN_INVALID_PROPERTY_ID (object, prop_id, pspec);
@@ -559,6 +585,7 @@ gtk_source_view_init (GtkSourceView *vie
 
 	view->priv->tabs_width = DEFAULT_TAB_WIDTH;
 	view->priv->margin = DEFAULT_MARGIN;
+	view->priv->highlight_current_line = -1;
 	view->priv->cached_margin_width = -1;
 	view->priv->smart_home_end = TRUE;
 	
@@ -725,6 +752,17 @@ set_source_buffer (GtkSourceView *view, 
 				  "marker_updated",
 				  G_CALLBACK (marker_updated_cb),
 				  view);
+		
+		/* Since the highlight_current_line property has moved to
+		 * GtkSourceBuffer and we've deprecated the property in
+		 * GtkSourceView, we need to set the property here. */
+		if (view->priv->highlight_current_line != -1)
+		{
+			gtk_source_buffer_set_highlight_current_line
+				(GTK_SOURCE_BUFFER (buffer),
+				 view->priv->highlight_current_line);
+			view->priv->highlight_current_line = -1;
+		}
 	}
 	else 
 	{
@@ -1341,50 +1379,6 @@ gtk_source_view_expose (GtkWidget      *
 				gdk_window_invalidate_rect (w, NULL, FALSE);
 		}
 
-		if (view->priv->highlight_current_line && 
-		    (event->window == gtk_text_view_get_window (text_view, GTK_TEXT_WINDOW_TEXT)))
-		{
-			GdkRectangle visible_rect;
-			GdkRectangle redraw_rect;
-			GtkTextIter cur;
-			gint y;
-			gint height;
-			gint win_y;
-			
-			gtk_text_buffer_get_iter_at_mark (text_view->buffer, 
-							  &cur, 
-							  gtk_text_buffer_get_insert (text_view->buffer));
-
-			gtk_text_view_get_line_yrange (text_view, &cur, &y, &height);
-							
-			gtk_text_view_get_visible_rect (text_view, &visible_rect);
-			
-			gtk_text_view_buffer_to_window_coords (text_view,
-						       GTK_TEXT_WINDOW_TEXT,
-						       visible_rect.x,
-						       visible_rect.y,
-						       &redraw_rect.x,
-						       &redraw_rect.y);
-
-			gtk_text_view_buffer_to_window_coords (text_view,
-						       GTK_TEXT_WINDOW_TEXT,
-						       0,
-						       y,
-						       NULL,
-						       &win_y);
-
-			redraw_rect.width = visible_rect.width;
-			redraw_rect.height = visible_rect.height;
-
-			gdk_draw_rectangle (event->window,
-					    widget->style->bg_gc[GTK_WIDGET_STATE (widget)],
-					    TRUE,
-					    redraw_rect.x + MAX (0, gtk_text_view_get_left_margin (text_view) - 1),
-					    win_y,
-					    redraw_rect.width,
-					    height);
-		}
-		
 		/* Have GtkTextView draw the text first. */
 		if (GTK_WIDGET_CLASS (parent_class)->expose_event)
 			event_handled = 
@@ -2308,6 +2302,7 @@ gtk_source_view_set_show_margin (GtkSour
 	g_object_notify (G_OBJECT (view), "show_margin");
 }
 
+#ifndef GTK_SOURCE_VIEW_DISABLE_DEPRECATED
 /**
  * gtk_source_view_get_highlight_current_line:
  * @view: a #GtkSourceView
@@ -2315,13 +2310,19 @@ gtk_source_view_set_show_margin (GtkSour
  * Returns whether the current line is highlighted
  *
  * Return value: TRUE if the current line is highlighted
+ *
+ * Deprecated: Use gtk_source_buffer_get_highlight_current_line() instead.
  **/
 gboolean 
 gtk_source_view_get_highlight_current_line (GtkSourceView *view)
 {
+	GtkSourceBuffer *buffer;
+	
 	g_return_val_if_fail (GTK_IS_SOURCE_VIEW (view), FALSE);
 
-	return view->priv->highlight_current_line;
+	buffer = GTK_SOURCE_BUFFER (gtk_text_view_get_buffer (GTK_TEXT_VIEW (view)));
+	
+	return gtk_source_buffer_get_highlight_current_line (buffer);
 }
 
 /**
@@ -2330,23 +2331,28 @@ gtk_source_view_get_highlight_current_li
  * @show: whether to highlight the current line
  *
  * If TRUE the current line is highlighted
+ *
+ * Deprecated: Use gtk_source_buffer_set_highlight_current_line() instead.
  **/
 void 
 gtk_source_view_set_highlight_current_line (GtkSourceView *view, gboolean hl)
 {
+	GtkSourceBuffer *buffer;
+	
 	g_return_if_fail (GTK_IS_SOURCE_VIEW (view));
 
+	buffer = GTK_SOURCE_BUFFER (gtk_text_view_get_buffer (GTK_TEXT_VIEW (view)));
+	
 	hl = (hl != FALSE);
 
-	if (view->priv->highlight_current_line == hl)
+	if (gtk_source_buffer_get_highlight_current_line (buffer) == hl)
 		return;
 
-	view->priv->highlight_current_line = hl;
-
-	gtk_widget_queue_draw (GTK_WIDGET (view));
+	gtk_source_buffer_set_highlight_current_line (buffer, hl);
 
 	g_object_notify (G_OBJECT (view), "highlight_current_line");
 }
+#endif /* GTK_SOURCE_VIEW_DISABLE_DEPRECATED */
 
 /**
  * gtk_source_view_get_margin:
@@ -2442,7 +2448,6 @@ gtk_source_view_get_smart_home_end (GtkS
 static void 
 gtk_source_view_style_set (GtkWidget *widget, GtkStyle *previous_style)
 {
-	GtkSourceView *view;
 	
 	g_return_if_fail (GTK_IS_SOURCE_VIEW (widget));
 	
@@ -2450,9 +2455,14 @@ gtk_source_view_style_set (GtkWidget *wi
 	if (GTK_WIDGET_CLASS (parent_class)->style_set)
 		(* GTK_WIDGET_CLASS (parent_class)->style_set) (widget, previous_style);
 
-	view = GTK_SOURCE_VIEW (widget);
 	if (previous_style)
 	{
+		GtkSourceView *view;
+		GtkSourceBuffer *buffer;
+		
+		view = GTK_SOURCE_VIEW (widget);
+		buffer = GTK_SOURCE_BUFFER (gtk_text_view_get_buffer (GTK_TEXT_VIEW (view)));
+		
 		/* If previous_style is NULL this is the initial
 		 * emission and we can't set the tab array since the
 		 * text view doesn't have a default style yet */
@@ -2461,6 +2471,9 @@ gtk_source_view_style_set (GtkWidget *wi
 		set_tab_stops_internal (view);
 		/* make sure the margin width is recalculated on next expose */
 		view->priv->cached_margin_width = -1;
+		
+		gtk_source_buffer_set_highlight_current_line_color
+			(buffer, &widget->style->bg[GTK_WIDGET_STATE (widget)]);
 	}
 }
 
Index: gtksourceview/gtksourceview.h
===================================================================
RCS file: /cvs/gnome/gtksourceview/gtksourceview/gtksourceview.h,v
retrieving revision 1.10
diff -u -p -r1.10 gtksourceview.h
--- gtksourceview/gtksourceview.h	8 Jan 2005 22:02:30 -0000	1.10
+++ gtksourceview/gtksourceview.h	16 Jan 2006 10:25:13 -0000
@@ -98,11 +98,13 @@ void		 gtk_source_view_set_show_margin 	
 							 gboolean         show);
 gboolean 	 gtk_source_view_get_show_margin 	(GtkSourceView   *view);
 
+#ifndef GTK_SOURCE_VIEW_DISABLE_DEPRECATED
 void		 gtk_source_view_set_highlight_current_line 	
 							(GtkSourceView   *view,
 							 gboolean         show);
 gboolean 	 gtk_source_view_get_highlight_current_line 	
 							(GtkSourceView   *view);
+#endif /* GTK_SOURCE_VIEW_DISABLE_DEPRECATED */
 
 void		 gtk_source_view_set_margin 		(GtkSourceView   *view,
 							 guint            margin);
Index: tests/test-widget.c
===================================================================
RCS file: /cvs/gnome/gtksourceview/tests/test-widget.c,v
retrieving revision 1.14
diff -u -p -r1.14 test-widget.c
--- tests/test-widget.c	14 Jan 2006 15:42:09 -0000	1.14
+++ tests/test-widget.c	16 Jan 2006 10:25:13 -0000
@@ -439,8 +439,9 @@ static void
 hl_line_toggled_cb (GtkAction *action, gpointer user_data)
 {
 	g_return_if_fail (GTK_IS_TOGGLE_ACTION (action) && GTK_IS_SOURCE_VIEW (user_data));
-	gtk_source_view_set_highlight_current_line (
-		GTK_SOURCE_VIEW (user_data),
+
+	gtk_source_buffer_set_highlight_current_line (
+		GTK_SOURCE_BUFFER (gtk_text_view_get_buffer (GTK_TEXT_VIEW (user_data))),
 		gtk_toggle_action_get_active (GTK_TOGGLE_ACTION (action)));
 }
 
