--- Desktop/geany-0.17/src/editor.c	2009-04-24 21:29:45.000000000 +0200
+++ geany-0.17/src/editor.c	2009-05-10 12:58:48.000000000 +0200
@@ -61,11 +61,12 @@
 #include "projectprivate.h"
 #include "queue.h"
 
-
+static nb_MultiEdits;
+static int position_MultiEdits[50]= {0}; 
+static void clear_MultiEdit(void);
 /* Note: Avoid using SSM in files not related to scintilla, use sciwrappers.h instead. */
 #define SSM(s, m, w, l) scintilla_send_message(s, m, w, l)
 
-
 static GeanyQueue *snippet_queue = NULL;
 static gint snippet_cursor_insert_pos;
 
@@ -90,6 +91,9 @@
 static gchar indent[100];
 
 
+static gboolean add_to_multi_edit(gint, GeanyEditor *editor);
+
+
 static void on_new_line_added(GeanyEditor *editor);
 static gboolean handle_xml(GeanyEditor *editor, gint pos, gchar ch);
 static void insert_indent_after_line(GeanyEditor *editor, gint line);
@@ -192,7 +196,16 @@
 	g_key_file_free(userconfig);
 }
 
+static gboolean on_editor_keypress_event(GtkWidget *widget, GdkEventKey *event, gpointer data)
+{
+	GeanyEditor *editor = data;
+	GeanyDocument *doc = editor->document;
+	
+	/* if delete has been pressed */
+	if (event->keyval == 65288) on_char_deleted(editor);
 
+	return FALSE;
+}
 static gboolean on_editor_button_press_event(GtkWidget *widget, GdkEventButton *event,
 											 gpointer data)
 {
@@ -207,7 +220,11 @@
 			(gint)event->x, (gint)event->y, FALSE);
 	else
 		editor_info.click_pos = sci_get_current_position(editor->sci);
-
+	
+	if ((event->button == 1) && (event->state != 12)) clear_MultiEdit();
+	//printf("Event.button = %i \n" , event->button );
+	//printf("state = %i \n" , event->state );
+	
 	if (event->button == 1)
 	{
 		guint state = event->state & gtk_accelerator_get_default_mod_mask();
@@ -229,9 +246,20 @@
 				keybindings_send_command(GEANY_KEY_GROUP_GOTO, GEANY_KEYS_GOTO_MATCHINGBRACE);
 			return TRUE;
 		}
+		if (event->type == GDK_BUTTON_PRESS && state == 12)
+		{
+			add_to_multi_edit(editor_info.click_pos, editor);
+			//sci_set_current_position(editor->sci, editor_info.click_pos, FALSE);
+			//printf("Could nicely trigger a multi event \n");
+			
+			return TRUE;
+		}
 		return document_check_disk_status(doc, FALSE);
+		
 	}
-
+	
+	
+	
 	/* calls the edit popup menu in the editor */
 	if (event->button == 3)
 	{
@@ -256,7 +284,31 @@
 	return FALSE;
 }
 
+static gboolean is_MultiEdit_Session() 
+{
+	if (nb_MultiEdits > 0) 
+		return TRUE;
+	else 
+		return FALSE;
+}
+static gboolean add_to_multi_edit(gint cursor_position, GeanyEditor* editor)
+{
+		//printf("%i should be added to multiline \n", cursor_position); 
+		//static nb_edits = 0;
+		//SSM(editor->sci, SCI_STYLESETBACK, 0, "#000000" );
+		position_MultiEdits[nb_MultiEdits] = cursor_position;
+		 nb_MultiEdits++;
+		 //printf("%i eme multi edit, at this position %i \n", nb_MultiEdits, position_MultiEdits[nb_MultiEdits - 1]);
+		
+		return TRUE;
+}
 
+static void clear_MultiEdit(void) 
+{
+	int i =0;	
+	for (i = 0 ; i < nb_MultiEdits; i++) position_MultiEdits[nb_MultiEdits] = 0;
+	nb_MultiEdits = 0;
+}
 static gboolean is_style_php(gint style)
 {
 	if ((style >= SCE_HPHP_DEFAULT && style <= SCE_HPHP_OPERATOR) ||
@@ -428,12 +480,59 @@
 	}
 }
 
+void delete_multiEdit(ScintillaObject *sci)
+{
+	
+	gint pos = sci_get_current_position(sci);
+	int i,j =0;	
+			
+	for(i=0; i < nb_MultiEdits; i++){
+		//printf("%i %i %s\n", i, position_MultiEdits[i],dummy);
+			
+		/*only works it edit are belows*/		
+		sci_goto_pos(sci, position_MultiEdits[i], FALSE);
+		SSM(sci, SCI_DELETEBACK, 0, 0);
+		position_MultiEdits[i] = position_MultiEdits[i] -2;
+		for (j = 1; j < nb_MultiEdits; j += 1) position_MultiEdits[i+j] = position_MultiEdits[i+j] -1;
+			
+	}
+		
+	sci_goto_pos(sci, pos, FALSE);
+}
+void on_char_deleted(GeanyEditor *editor)
+{
+	ScintillaObject *sci = editor->sci;
+	if(is_MultiEdit_Session())
+		delete_multiEdit(sci);
+
+
+}
 
 static void on_char_added(GeanyEditor *editor, SCNotification *nt)
 {
 	ScintillaObject *sci = editor->sci;
 	gint pos = sci_get_current_position(sci);
-
+	
+	if (is_MultiEdit_Session()) {
+		char dummy[2];
+		dummy[0] = nt->ch;
+		dummy[1] = '\0';
+		int i,j =0;	
+			
+		for(i=0; i < nb_MultiEdits; i++){
+			//printf("%i %i %s\n", i, position_MultiEdits[i],dummy);
+			
+			/*only works it edit are belows*/		
+			sci_goto_pos(sci, position_MultiEdits[i], FALSE);
+			SSM(sci, SCI_INSERTTEXT, position_MultiEdits[i]+1, dummy);
+			position_MultiEdits[i] = position_MultiEdits[i] +2  ;
+			for (j = 1; j < nb_MultiEdits; j += 1) position_MultiEdits[i+j] = position_MultiEdits[i+j] +1;
+			
+		}
+		
+		sci_goto_pos(sci, pos, FALSE);
+		
+	}				
 	switch (nt->ch)
 	{
 		case '\r':
@@ -664,7 +763,7 @@
 	GeanyDocument *doc = editor->document;
 
 	switch (nt->nmhdr.code)
-	{
+	{	
 		case SCN_SAVEPOINTLEFT:
 		{
 			document_set_text_changed(doc, TRUE);
@@ -684,12 +783,26 @@
 			on_margin_click(sci, nt);
 			break;
 
-		case SCN_UPDATEUI:
-			on_update_ui(editor, nt);
-			break;
+		
 
  		case SCN_MODIFIED:
-		{
+		{	
+			//if (nt->modificationType & SC_MOD_INSERTTEXT) SSM(sci, SCI_BEGINUNDOACTION,0,0);
+			
+			
+		
+			if (nt->modificationType & SC_MOD_DELETETEXT)
+			{
+				//on_char_deleted(editor, nt);
+				
+			
+			}
+			//sci_goto_pos(sci,pos, FALSE);
+						
+			
+			
+			
+			
 			if (editor_prefs.show_linenumber_margin && (nt->modificationType & (SC_MOD_INSERTTEXT | SC_MOD_DELETETEXT)) && nt->linesAdded)
 			{
 				/* automatically adjust Scintilla's line numbers margin width */
@@ -708,10 +821,16 @@
 			}
 			break;
 		}
+		case SCN_UPDATEUI:
+			on_update_ui(editor, nt);
+			break;
+			
 		case SCN_CHARADDED:
+			SSM(sci, SCI_BEGINUNDOACTION, 0, 0);
 			on_char_added(editor, nt);
+			SSM(sci, SCI_ENDUNDOACTION, 0, 0);
 			break;
-
+		
 		case SCN_USERLISTSELECTION:
 		{
 			if (nt->listType == 1)
@@ -4295,6 +4414,7 @@
 	if (editor->sci == NULL)
 	{
 		g_signal_connect(sci, "button-press-event", G_CALLBACK(on_editor_button_press_event), editor);
+		g_signal_connect(sci, "key-press-event", G_CALLBACK(on_editor_keypress_event), editor);		
 		g_signal_connect(sci, "scroll-event", G_CALLBACK(on_editor_scroll_event), editor);
 		g_signal_connect(sci, "motion-notify-event", G_CALLBACK(on_motion_event), NULL);
 		g_signal_connect(sci, "expose-event", G_CALLBACK(on_editor_expose_event), editor);
