[anjuta/gnome-2-32] language-support-cpp-java: bgo#633112 - Smart Brace Completion Quotation Mark Crash



commit 16821343b7d665b1eb9b3f862e2efb1e67838e4f
Author: Johannes Schmid <jhs gnome org>
Date:   Wed Nov 10 11:26:33 2010 +0100

    language-support-cpp-java: bgo#633112 - Smart Brace Completion Quotation Mark Crash

 plugins/language-support-cpp-java/plugin.c |   26 +++++++++++++++++++++-----
 1 files changed, 21 insertions(+), 5 deletions(-)
---
diff --git a/plugins/language-support-cpp-java/plugin.c b/plugins/language-support-cpp-java/plugin.c
index fd6ca66..e6fde1c 100644
--- a/plugins/language-support-cpp-java/plugin.c
+++ b/plugins/language-support-cpp-java/plugin.c
@@ -1406,6 +1406,22 @@ get_line_auto_indentation (CppJavaPlugin *plugin, IAnjutaEditor *editor,
 	return line_indent;
 }
 
+static void on_editor_char_inserted_cpp (IAnjutaEditor *editor,
+                                         IAnjutaIterable *insert_pos,
+                                         gchar ch,
+                                         CppJavaPlugin *plugin);
+
+static void
+insert_editor_blocked (IAnjutaEditor* editor,
+                       IAnjutaIterable* iter,
+                       gchar* text,
+                       CppJavaPlugin* plugin)
+{
+	g_signal_handlers_block_by_func (editor, on_editor_char_inserted_cpp, plugin);
+	ianjuta_editor_insert (editor, iter, text, -1, NULL);
+	g_signal_handlers_unblock_by_func (editor, on_editor_char_inserted_cpp, plugin);
+}
+
 static void
 on_editor_char_inserted_cpp (IAnjutaEditor *editor,
 							 IAnjutaIterable *insert_pos,
@@ -1503,12 +1519,12 @@ on_editor_char_inserted_cpp (IAnjutaEditor *editor,
 				switch (ch)
 				{
 					case '[': 
-							  ianjuta_editor_insert (editor, iter,
-													 "]", 1, NULL);
+							  insert_editor_blocked (editor, iter,
+													 "]", plugin);
 							  break;
 					case '(': 
-							  ianjuta_editor_insert (editor, iter,
-													 ")", 1, NULL);
+							  insert_editor_blocked (editor, iter,
+													 ")", plugin);
 							  break;
 					default: 
 						       break;
@@ -1548,7 +1564,7 @@ on_editor_char_inserted_cpp (IAnjutaEditor *editor,
 					else c = g_strdup ("'");
 					
 					ianjuta_document_begin_undo_action (IANJUTA_DOCUMENT (editor), NULL);
-					ianjuta_editor_insert (editor, iter, c, 1, NULL);
+					insert_editor_blocked (editor, iter, c, plugin);
 					ianjuta_editor_goto_position (editor, iter, NULL);
 					ianjuta_document_end_undo_action (IANJUTA_DOCUMENT (editor), NULL);	
 					



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