[Commits] [SCM] claws branch, master, updated. 3.9.3-223-g78b5d80

colin at claws-mail.org colin at claws-mail.org
Fri May 23 11:21:45 CEST 2014


The branch master of project "claws" (Claws Mail) has been updated
       via  78b5d80a0b371d3091b0a0ff85704e3d516222a6 (commit)
      from  d7493e38a465649d0e56b3e3c86f3b9085372d61 (commit)


- Log -----------------------------------------------------------------
commit 78b5d80a0b371d3091b0a0ff85704e3d516222a6
Author: Colin Leroy <colin at colino.net>
Date:   Fri May 23 11:21:56 2014 +0200

    Fix crash with auto-indent

diff --git a/src/undo.c b/src/undo.c
index 86cfdd1..61c4573 100644
--- a/src/undo.c
+++ b/src/undo.c
@@ -600,6 +600,9 @@ static void end_wrap_undo(UndoMain *undostruct)
 	if (undostruct->wrap_info->start_pos == -1)
 		goto cleanup;
 
+	cm_return_if_fail(undostruct->wrap_info->end_pos > undostruct->wrap_info->start_pos);
+	cm_return_if_fail(undostruct->wrap_info->end_pos - undostruct->wrap_info->len_change > undostruct->wrap_info->start_pos);
+
 	/* get the whole new (wrapped) contents */
 	buffer = gtk_text_view_get_buffer(undostruct->textview);
 	gtk_text_buffer_get_start_iter(buffer, &start);
@@ -668,14 +671,18 @@ static void update_wrap_undo(UndoMain *undostruct, const gchar *text, int start,
 		 * change, and the total length of the changed region
 		 * increases.
 		 */
-		undostruct->wrap_info->end_pos = end;
+		if (end > undostruct->wrap_info->end_pos) {
+			undostruct->wrap_info->end_pos = end;
+		}
 		undostruct->wrap_info->len_change += len;
 	} else if (action == UNDO_ACTION_DELETE) {
 		/* If deleting, the end of the region is at the start of the
 		 * change, and the total length of the changed region
 		 * decreases.
 		 */
-		undostruct->wrap_info->end_pos = start;
+		if (start > undostruct->wrap_info->end_pos) {
+			undostruct->wrap_info->end_pos = start;
+		}
 		undostruct->wrap_info->len_change -= len;
 	}
 }

-----------------------------------------------------------------------

Summary of changes:
 src/undo.c |   11 +++++++++--
 1 file changed, 9 insertions(+), 2 deletions(-)


hooks/post-receive
-- 
Claws Mail


More information about the Commits mailing list