2008-08-21 [colin] 3.5.0cvs66
authorColin Leroy <colin@colino.net>
Thu, 21 Aug 2008 07:32:45 +0000 (07:32 +0000)
committerColin Leroy <colin@colino.net>
Thu, 21 Aug 2008 07:32:45 +0000 (07:32 +0000)
* src/compose.c
* src/prefs_common.c
* src/prefs_common.h
* src/prefs_wrapping.c
Add a preference for autoindent; fix no_join tag
being applied to whole lines instead of just \n when
creating a line

ChangeLog
PATCHSETS
configure.ac
src/compose.c
src/prefs_common.c
src/prefs_common.h
src/prefs_wrapping.c

index 92459fc..b54278d 100644 (file)
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,3 +1,13 @@
+2008-08-21 [colin]     3.5.0cvs66
+
+       * src/compose.c
+       * src/prefs_common.c
+       * src/prefs_common.h
+       * src/prefs_wrapping.c
+               Add a preference for autoindent; fix no_join tag
+               being applied to whole lines instead of just \n when
+               creating a line 
+
 2008-08-21 [colin]     3.5.0cvs65
 
        * src/compose.c
index a47c8c8..dfd1b81 100644 (file)
--- a/PATCHSETS
+++ b/PATCHSETS
 ( cvs diff -u -r 1.274.2.267 -r 1.274.2.268 src/mainwindow.c;  ) > 3.5.0cvs63.patchset
 ( cvs diff -u -r 1.382.2.466 -r 1.382.2.467 src/compose.c;  ) > 3.5.0cvs64.patchset
 ( cvs diff -u -r 1.382.2.467 -r 1.382.2.468 src/compose.c;  ) > 3.5.0cvs65.patchset
+( cvs diff -u -r 1.382.2.468 -r 1.382.2.469 src/compose.c;  cvs diff -u -r 1.204.2.176 -r 1.204.2.177 src/prefs_common.c;  cvs diff -u -r 1.103.2.111 -r 1.103.2.112 src/prefs_common.h;  cvs diff -u -r 1.1.2.16 -r 1.1.2.17 src/prefs_wrapping.c;  ) > 3.5.0cvs66.patchset
index 16a2b6c..d2d8787 100644 (file)
@@ -11,7 +11,7 @@ MINOR_VERSION=5
 MICRO_VERSION=0
 INTERFACE_AGE=0
 BINARY_AGE=0
-EXTRA_VERSION=65
+EXTRA_VERSION=66
 EXTRA_RELEASE=
 EXTRA_GTK2_VERSION=
 
index 6f4b210..94bdd11 100644 (file)
@@ -4135,7 +4135,7 @@ static gboolean compose_beautify_paragraph(Compose *compose, GtkTextIter *par_it
                                modified = TRUE;
                                gtk_text_buffer_insert(buffer, &break_pos, "\n", 1);
                                compose->automatic_break = FALSE;
-                               if (itemized_len) {
+                               if (itemized_len && prefs_common.auto_indent) {
                                        gtk_text_buffer_insert(buffer, &break_pos, itemized_chars, -1);
                                        if (!item_continuation)
                                                gtk_text_buffer_insert(buffer, &break_pos, "  ", 2);
@@ -4145,7 +4145,7 @@ static gboolean compose_beautify_paragraph(Compose *compose, GtkTextIter *par_it
                                modified = TRUE;
                                gtk_text_buffer_insert(buffer, &break_pos, "\n", 1);
                                compose->automatic_break = FALSE;
-                               if (itemized_len) {
+                               if (itemized_len && prefs_common.auto_indent) {
                                        gtk_text_buffer_insert(buffer, &break_pos, itemized_chars, -1);
                                        if (!item_continuation)
                                                gtk_text_buffer_insert(buffer, &break_pos, "  ", 2);
@@ -4155,7 +4155,7 @@ static gboolean compose_beautify_paragraph(Compose *compose, GtkTextIter *par_it
                        /* remove trailing spaces */
                        cur = break_pos;
                        rem_item_len = itemized_len;
-                       while (rem_item_len-- > 0)
+                       while (prefs_common.auto_indent && rem_item_len-- > 0)
                                gtk_text_iter_backward_char(&cur);
                        gtk_text_iter_backward_char(&cur);
 
@@ -10346,9 +10346,15 @@ static void text_inserted(GtkTextBuffer *buffer, GtkTextIter *iter,
                gtk_text_buffer_delete_mark(buffer, mark);
        } else {
                if (strcmp(text, "\n") || compose->automatic_break
-               || gtk_text_iter_starts_line(iter))
+               || gtk_text_iter_starts_line(iter)) {
+                       GtkTextIter before_ins;
                        gtk_text_buffer_insert(buffer, iter, text, len);
-               else {
+                       if (!strstr(text, "\n") && gtk_text_iter_has_tag(iter, compose->no_join_tag)) {
+                               before_ins = *iter; 
+                               gtk_text_iter_backward_chars(&before_ins, len);
+                               gtk_text_buffer_remove_tag_by_name(buffer, "no_join", &before_ins, iter);
+                       }
+               } else {
                        /* check if the preceding is just whitespace or quote */
                        GtkTextIter start_line;
                        gchar *tmp = NULL, *quote = NULL;
@@ -10357,6 +10363,7 @@ static void text_inserted(GtkTextBuffer *buffer, GtkTextIter *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 {
index 6b65a4f..eb8a589 100644 (file)
@@ -239,6 +239,8 @@ static PrefParam param[] = {
         NULL, NULL, NULL},
        {"linewrap_auto", "TRUE", &prefs_common.autowrap, P_BOOL,
         NULL, NULL, NULL},
+       {"auto_indent", "TRUE", &prefs_common.auto_indent, P_BOOL,
+        NULL, NULL, NULL},
         {"autosave", "TRUE", &prefs_common.autosave,
         P_BOOL, NULL, NULL, NULL},
         {"autosave_length", "50", &prefs_common.autosave_length, P_INT,
index 471fcff..d607ab7 100644 (file)
@@ -140,6 +140,7 @@ struct _PrefsCommon
        gboolean linewrap_quote;
        gboolean linewrap_pastes;
        gboolean autowrap;
+       gboolean auto_indent;
        gboolean auto_exteditor;
        gboolean reply_account_autosel;
        gboolean default_reply_list;
index 0e7f5b7..ddee63b 100644 (file)
@@ -49,6 +49,7 @@ typedef struct _WrappingPage
        GtkWidget *checkbtn_wrapquote;
        GtkWidget *checkbtn_wrappastes;
        GtkWidget *checkbtn_autowrap;
+       GtkWidget *checkbtn_autoindent;
 } WrappingPage;
 
 static void prefs_wrapping_create_widget(PrefsPage *_page, GtkWindow *window, 
@@ -64,6 +65,7 @@ static void prefs_wrapping_create_widget(PrefsPage *_page, GtkWindow *window,
        GtkWidget *checkbtn_wrapquote;
        GtkWidget *checkbtn_wrappastes;
        GtkWidget *checkbtn_autowrap;
+       GtkWidget *checkbtn_autoindent;
        GtkWidget *hbox1;
 
        vbox1 = gtk_vbox_new (FALSE, VSPACING);
@@ -77,6 +79,7 @@ static void prefs_wrapping_create_widget(PrefsPage *_page, GtkWindow *window,
        PACK_CHECK_BUTTON (vbox2, checkbtn_autowrap, _("Auto wrapping"));
        PACK_CHECK_BUTTON (vbox2, checkbtn_wrapquote, _("Wrap quotation"));
        PACK_CHECK_BUTTON (vbox2, checkbtn_wrappastes, _("Wrap pasted text"));
+       PACK_CHECK_BUTTON (vbox2, checkbtn_autoindent, _("Follow indentation"));
 
        hbox1 = gtk_hbox_new (FALSE, 8);
        gtk_widget_show (hbox1);
@@ -104,6 +107,8 @@ static void prefs_wrapping_create_widget(PrefsPage *_page, GtkWindow *window,
                                     prefs_common.linewrap_quote);
        gtk_toggle_button_set_active(GTK_TOGGLE_BUTTON(checkbtn_wrappastes),
                                     prefs_common.linewrap_pastes);
+       gtk_toggle_button_set_active(GTK_TOGGLE_BUTTON(checkbtn_autoindent),
+                                    prefs_common.auto_indent);
        gtk_spin_button_set_value(GTK_SPIN_BUTTON(spinbtn_linewrap),
                                  prefs_common.linewrap_len);
 
@@ -112,6 +117,7 @@ static void prefs_wrapping_create_widget(PrefsPage *_page, GtkWindow *window,
        prefs_wrapping->checkbtn_wrapquote      = checkbtn_wrapquote;
        prefs_wrapping->checkbtn_wrappastes     = checkbtn_wrappastes;
        prefs_wrapping->checkbtn_autowrap       = checkbtn_autowrap;
+       prefs_wrapping->checkbtn_autoindent     = checkbtn_autoindent;
 
        prefs_wrapping->page.widget = vbox1;
 }
@@ -128,6 +134,8 @@ static void prefs_wrapping_save(PrefsPage *_page)
                gtk_toggle_button_get_active(GTK_TOGGLE_BUTTON(page->checkbtn_wrappastes));
        prefs_common.autowrap =
                gtk_toggle_button_get_active(GTK_TOGGLE_BUTTON(page->checkbtn_autowrap));
+       prefs_common.auto_indent =
+               gtk_toggle_button_get_active(GTK_TOGGLE_BUTTON(page->checkbtn_autoindent));
 }
 
 static void prefs_wrapping_destroy_widget(PrefsPage *_page)