Sisyphus repositório
Última atualização: 1 outubro 2023 | SRPMs: 18631 | Visitas: 37478331
en ru br
ALT Linux repositórios
S:4.1.1-alt2
5.0: 3.6.1.cvs5-alt1.2
4.1: 3.6.1.cvs5-alt0.M41.2
4.0: 3.6.1.cvs5-alt0.M40.1

Outros repositórios
Upstream:3.3.1

Group :: Rede/E-Mail
RPM: claws-mail

 Main   Changelog   Spec   Patches   Sources   Download   Gear   Bugs e FR  Repocop 

Patch: claws-mail-3.7.6-fix-undo-redo-replace.patch
Download


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();
 
projeto & código: Vladimir Lettiev aka crux © 2004-2005, Andrew Avramenko aka liks © 2007-2008
mantenedor atual: Michael Shigorin
mantenedor da tradução: Fernando Martini aka fmartini © 2009