2008-02-01 [colin] 3.2.0cvs74
authorColin Leroy <colin@colino.net>
Fri, 1 Feb 2008 16:48:40 +0000 (16:48 +0000)
committerColin Leroy <colin@colino.net>
Fri, 1 Feb 2008 16:48:40 +0000 (16:48 +0000)
* src/compose.c
Possibly fix the annoying and hard-to reproduce bug
where lines
are
rewrapped
like
that.

ChangeLog
PATCHSETS
configure.ac
src/compose.c

index b49ee880e617ce90aad9cc20bb6055d0dca70465..fac3f7c1180af1d0614c888924e739a6495a54ff 100644 (file)
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,3 +1,13 @@
+2008-02-01 [colin]     3.2.0cvs74
+
+       * src/compose.c
+               Possibly fix the annoying and hard-to reproduce bug
+               where lines 
+               are
+               rewrapped
+               like
+               that.
+
 2008-02-01 [paul]      3.2.0cvs73
 
        * src/common/utils.c
index e252b6151e396e30f7d7a1ca56eecd7e8fcb01ac..73ba6cb675191055a05bb2c1001e24b511465f93 100644 (file)
--- a/PATCHSETS
+++ b/PATCHSETS
 ( cvs diff -u -r 1.115.2.183 -r 1.115.2.184 src/main.c;  ) > 3.2.0cvs71.patchset
 ( cvs diff -u -r 1.3.2.23 -r 1.3.2.24 src/exphtmldlg.c;  cvs diff -u -r 1.83.2.125 -r 1.83.2.126 src/mimeview.c;  cvs diff -u -r 1.395.2.353 -r 1.395.2.354 src/summaryview.c;  ) > 3.2.0cvs72.patchset
 ( cvs diff -u -r 1.36.2.133 -r 1.36.2.134 src/common/utils.c;  ) > 3.2.0cvs73.patchset
+( cvs diff -u -r 1.382.2.435 -r 1.382.2.436 src/compose.c;  ) > 3.2.0cvs74.patchset
index 149fa758d380227cdc0e95834af3c78053d0d44e..8a23bfc19584b41fc3fd5b4a48b3a4acf911e223 100644 (file)
@@ -11,7 +11,7 @@ MINOR_VERSION=2
 MICRO_VERSION=0
 INTERFACE_AGE=0
 BINARY_AGE=0
-EXTRA_VERSION=73
+EXTRA_VERSION=74
 EXTRA_RELEASE=
 EXTRA_GTK2_VERSION=
 
index 7c5b4e364e927fa0f54ebd4f02c012e8c9e962a8..ac42bb10a801ee41658dd5e3c0aee1506ffdb223 100644 (file)
@@ -3792,9 +3792,9 @@ static gboolean compose_join_next_line(Compose *compose,
        gboolean keep_cursor = FALSE;
 
        if (!gtk_text_iter_forward_line(&iter_) ||
-           gtk_text_iter_ends_line(&iter_))
+           gtk_text_iter_ends_line(&iter_)) {
                return FALSE;
-
+       }
        next_quote_str = compose_get_quote_str(buffer, &iter_, &quote_len);
 
        if ((quote_str || next_quote_str) &&
@@ -3807,18 +3807,20 @@ static gboolean compose_join_next_line(Compose *compose,
        end = iter_;
        if (quote_len > 0) {
                gtk_text_iter_forward_chars(&end, quote_len);
-               if (gtk_text_iter_ends_line(&end))
+               if (gtk_text_iter_ends_line(&end)) {
                        return FALSE;
+               }
        }
 
        /* don't join itemized lines */
-       if (compose_is_itemized(buffer, &end))
+       if (compose_is_itemized(buffer, &end)) {
                return FALSE;
+       }
 
        /* don't join signature separator */
-       if (compose_is_sig_separator(compose, buffer, &iter_))
+       if (compose_is_sig_separator(compose, buffer, &iter_)) {
                return FALSE;
-
+       }
        /* delete quote str */
        if (quote_len > 0)
                gtk_text_buffer_delete(buffer, &iter_, &end);
@@ -9972,9 +9974,30 @@ static void text_inserted(GtkTextBuffer *buffer, GtkTextIter *iter,
                || gtk_text_iter_starts_line(iter))
                        gtk_text_buffer_insert(buffer, iter, text, len);
                else {
-                       debug_print("insert nowrap \\n\n");
-                       gtk_text_buffer_insert_with_tags_by_name(buffer, 
-                               iter, text, len, "no_join", NULL);
+                       /* check if the preceding is just whitespace or quote */
+                       GtkTextIter start_line;
+                       gchar *tmp = NULL, *quote = NULL;
+                       gint quote_len = 0, is_normal = 0;
+                       start_line = *iter;
+                       gtk_text_iter_set_line_offset(&start_line, 0); 
+                       tmp = gtk_text_buffer_get_text(buffer, &start_line, iter, FALSE);
+                       g_strstrip(tmp);
+                       if (*tmp == '\0') {
+                               is_normal = 1;
+                       } else {
+                               quote = compose_get_quote_str(buffer, &start_line, &quote_len);
+                               if (quote)
+                                       is_normal = 1;
+                               g_free(quote);
+                       }
+                       g_free(tmp);
+                       
+                       if (is_normal) {
+                               gtk_text_buffer_insert(buffer, iter, text, len);
+                       } else {
+                               gtk_text_buffer_insert_with_tags_by_name(buffer, 
+                                       iter, text, len, "no_join", NULL);
+                       }
                }
        }