[anjuta] sourceview: Don't process text (for example by language-support) if it was inserted programatically.



commit c42fd4f754f6635067585081a31d149bce3fb586
Author: Johannes Schmid <jhs gnome org>
Date:   Tue Jan 25 15:31:09 2011 +0100

    sourceview: Don't process text (for example by language-support) if it was inserted programatically.

 plugins/sourceview/sourceview.c |   16 ++++++++++++++++
 1 files changed, 16 insertions(+), 0 deletions(-)
---
diff --git a/plugins/sourceview/sourceview.c b/plugins/sourceview/sourceview.c
index 9622188..566d489 100644
--- a/plugins/sourceview/sourceview.c
+++ b/plugins/sourceview/sourceview.c
@@ -1148,9 +1148,17 @@ static void ieditor_insert(IAnjutaEditor *editor, IAnjutaIterable* icell,
 	GtkTextIter iter;
 	Sourceview* sv = ANJUTA_SOURCEVIEW(editor);
 	sourceview_cell_get_iter (cell, &iter);
+
+	/* Avoid processing text that is inserted programatically */
+	g_signal_handlers_block_by_func (sv->priv->document,
+	                                 on_insert_text,
+	                                 sv);
 	
 	gtk_text_buffer_insert(GTK_TEXT_BUFFER(sv->priv->document),
 						   &iter, text, length);
+	g_signal_handlers_unblock_by_func (sv->priv->document,
+	                                   on_insert_text,
+	                                   sv);
 }
 
 /* Append text to buffer */
@@ -1162,8 +1170,16 @@ static void ieditor_append(IAnjutaEditor *editor, const gchar* text,
 
 	gtk_text_buffer_get_end_iter(GTK_TEXT_BUFFER(sv->priv->document),
 									   &iter);
+
+	/* Avoid processing text that is inserted programatically */
+	g_signal_handlers_block_by_func (sv->priv->document,
+	                                 on_insert_text,
+	                                 sv);
 	gtk_text_buffer_insert(GTK_TEXT_BUFFER(sv->priv->document),
 						   &iter, text, length);
+	g_signal_handlers_unblock_by_func (sv->priv->document,
+	                                   on_insert_text,
+	                                   sv);
 }
 
 static void ieditor_erase(IAnjutaEditor* editor, IAnjutaIterable* istart_cell, 



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