Репозитории ALT
S: | 4.1.1-alt2 |
5.1: | 3.7.4-alt0.M50P.1 |
4.1: | 3.6.1.cvs5-alt0.M41.2 |
4.0: | 3.6.1.cvs5-alt0.M40.1 |
Другие репозитории
Upstream: | 3.3.1 |
Группа :: Сети/Почта
Пакет: claws-mail
Главная Изменения Спек Патчи Sources Загрузить Gear Bugs and FR Repocop
Патч: claws-mail-3.7.6-fix-undo-redo-replace.patch
Скачать
Скачать
diff --git src/undo.c src/undo.c
index 39aa54b..7551570 100644
--- src/undo.c
+++ src/undo.c
@@ -394,7 +394,19 @@ void undo_undo(UndoMain *undostruct)
}
break;
case UNDO_ACTION_REPLACE_DELETE:
- g_warning("This should not happen. UNDO_REPLACE_DELETE");
+ gtk_text_buffer_get_iter_at_offset(buffer, &start_iter, undoinfo->start_pos);
+ gtk_text_buffer_insert(buffer, &start_iter, undoinfo->text, -1);
+ /* "pull" another data structure from the list */
+ if (undostruct->undo){
+ undoinfo = (UndoInfo *)undostruct->undo->data;
+ undostruct->redo = g_list_prepend(undostruct->redo, undoinfo);
+ undostruct->undo = g_list_remove(undostruct->undo, undoinfo);
+ cm_return_if_fail(undoinfo != NULL);
+ cm_return_if_fail(undoinfo->action == UNDO_ACTION_REPLACE_INSERT);
+ gtk_text_buffer_get_iter_at_offset(buffer, &start_iter, undoinfo->start_pos);
+ gtk_text_buffer_get_iter_at_offset(buffer, &end_iter, undoinfo->end_pos);
+ gtk_text_buffer_delete(buffer, &start_iter, &end_iter);
+ }
break;
default:
g_assert_not_reached();
@@ -476,9 +488,19 @@ void undo_redo(UndoMain *undostruct)
gtk_text_buffer_insert(buffer, &start_iter, redoinfo->text, -1);
break;
case UNDO_ACTION_REPLACE_INSERT:
- /* This is needed only if we redo from a middle-click button */
gtk_text_buffer_get_iter_at_offset(buffer, &iter, redoinfo->start_pos);
gtk_text_buffer_insert(buffer, &iter, redoinfo->text, -1);
+ /* "pull" another data structure from the list */
+ redoinfo = (UndoInfo *)undostruct->redo->data;
+ /* Do nothing if we redo from a middle-click button
+ * and next action is not UNDO_ACTION_REPLACE_DELETE */
+ if (redoinfo && redoinfo->action == UNDO_ACTION_REPLACE_DELETE) {
+ undostruct->undo = g_list_prepend(undostruct->undo, redoinfo);
+ undostruct->redo = g_list_remove(undostruct->redo, redoinfo);
+ gtk_text_buffer_get_iter_at_offset(buffer, &start_iter, redoinfo->start_pos);
+ gtk_text_buffer_get_iter_at_offset(buffer, &end_iter, redoinfo->end_pos);
+ gtk_text_buffer_delete(buffer, &start_iter, &end_iter);
+ }
break;
default:
g_assert_not_reached();