+ if (undostruct->wrap && undostruct->undo) {
+ UndoInfo *last_undo = undostruct->undo->data;
+ if (last_undo && last_undo->action == UNDO_ACTION_INSERT
+ && last_undo->start_pos < start_pos && last_undo->end_pos > end_pos) {
+ GtkTextIter start,end;
+ last_undo->end_pos -= g_utf8_strlen(text_to_delete, -1);
+ gtk_text_buffer_get_iter_at_offset(textbuf, &start, last_undo->start_pos);
+ gtk_text_buffer_get_iter_at_offset(textbuf, &end, last_undo->end_pos);
+ g_free(last_undo->text);
+ last_undo->text = gtk_text_buffer_get_text(textbuf, &start, &end, FALSE);
+ debug_print("del:undo upd %d-%d\n", last_undo->start_pos, last_undo->end_pos);
+ return;
+ } else debug_print("del:last: %d, %d-%d (%d)\n", last_undo->action,
+ last_undo->start_pos, last_undo->end_pos, start_pos);
+
+ }
+ debug_print("del:undo add %d-%d\n", start_pos, end_pos);