balsa r7960 - in trunk: . libbalsa src
- From: PeterB svn gnome org
- To: svn-commits-list gnome org
- Subject: balsa r7960 - in trunk: . libbalsa src
- Date: Sat, 23 Aug 2008 13:26:42 +0000 (UTC)
Author: PeterB
Date: Sat Aug 23 13:26:42 2008
New Revision: 7960
URL: http://svn.gnome.org/viewvc/balsa?rev=7960&view=rev
Log:
we wrap a flowed message only on sending
Modified:
trunk/ChangeLog
trunk/libbalsa/mime.c
trunk/libbalsa/misc.h
trunk/src/balsa-mime-widget-text.c
trunk/src/sendmsg-window.c
Modified: trunk/libbalsa/mime.c
==============================================================================
--- trunk/libbalsa/mime.c (original)
+++ trunk/libbalsa/mime.c Sat Aug 23 13:26:42 2008
@@ -483,7 +483,6 @@
GtkTextBuffer *buffer = gtk_text_view_get_buffer(view);
GtkTextTagTable *table = gtk_text_buffer_get_tag_table(buffer);
GtkTextTag *url_tag = gtk_text_tag_table_lookup(table, "url");
- GtkTextTag *soft_tag = gtk_text_tag_table_lookup(table, "soft");
GtkTextIter iter;
PangoContext *context = gtk_widget_get_pango_context(GTK_WIDGET(view));
PangoLanguage *language = pango_context_get_language(context);
@@ -567,8 +566,7 @@
gtk_text_buffer_delete(buffer, &start, &iter);
}
- gtk_text_buffer_insert_with_tags(buffer, &iter, "\n", 1,
- soft_tag, NULL);
+ gtk_text_buffer_insert(buffer, &iter, "\n", 1);
if (quote_string)
gtk_text_buffer_insert_with_tags(buffer, &iter,
quote_string, -1,
@@ -677,64 +675,28 @@
gint num_paras)
{
GtkTextTagTable *table = gtk_text_buffer_get_tag_table(buffer);
- GtkTextTag *soft_tag = gtk_text_tag_table_lookup(table, "soft");
GtkTextTag *url_tag = gtk_text_tag_table_lookup(table, "url");
/* Check whether the previous line flowed into this one. */
gtk_text_iter_set_line_offset(iter, 0);
- if (gtk_text_iter_ends_tag(iter, soft_tag))
- gtk_text_iter_backward_line(iter);
for (; num_paras; num_paras--) {
gint quote_depth;
- gint qd;
GtkTextIter start;
gchar *line;
gtk_text_iter_set_line_offset(iter, 0);
quote_depth = get_quote_depth(iter, NULL);
- for (;;) {
- gchar *quote_string;
- gboolean stuffed;
-
- /* Move to the end of the line, if not there already. */
- if (!gtk_text_iter_ends_line(iter)
- && !gtk_text_iter_forward_to_line_end(iter))
- return;
- /* Save this iter as the start of a possible deletion. */
- start = *iter;
- /* Move to the start of the next line. */
- if (!gtk_text_iter_forward_line(iter))
- return;
-
- qd = get_quote_depth(iter, "e_string);
- stuffed = quote_string && quote_string[qd];
- g_free(quote_string);
-
- if (gtk_text_iter_has_tag(&start, soft_tag)) {
- if (qd != quote_depth) {
- /* Broken: use quote-depth-wins. */
- GtkTextIter end = start;
- gtk_text_iter_forward_to_tag_toggle(&end, soft_tag);
- gtk_text_buffer_remove_tag(buffer, soft_tag,
- &start, &end);
- break;
- }
- } else
- /* Hard newline. */
- break;
-
- if (qd > 0 && !stuffed) {
- /* User deleted the space following the '>' chars; we'll
- * delete the space at the end of the previous line, if
- * there was one. */
- gtk_text_iter_backward_char(&start);
- if (gtk_text_iter_get_char(&start) != ' ')
- gtk_text_iter_forward_char(&start);
- }
- gtk_text_buffer_delete(buffer, &start, iter);
- }
+ /* Move to the end of the line, if not there already. */
+ if (!gtk_text_iter_ends_line(iter)
+ && !gtk_text_iter_forward_to_line_end(iter))
+ return;
+ /* Save this iter as the start of a possible deletion. */
+ start = *iter;
+ /* Move to the start of the next line. */
+ if (!gtk_text_iter_forward_line(iter))
+ return;
if (num_paras < 0) {
/* This is a wrap_body call, not a continuous wrap, so we'll
@@ -749,10 +711,11 @@
&& gtk_text_iter_get_char(&tmp_iter) == '-'
&& gtk_text_iter_backward_char(&tmp_iter)
&& gtk_text_iter_get_char(&tmp_iter) == '-'
- && gtk_text_iter_get_line_offset(&tmp_iter) == qd)) {
+ && gtk_text_iter_get_line_offset(&tmp_iter) ==
+ quote_depth)) {
*iter = start;
while (gtk_text_iter_get_line_offset(&start) >
- (qd ? qd + 1 : 0)) {
+ (quote_depth ? quote_depth + 1 : 0)) {
gtk_text_iter_backward_char(&start);
if (gtk_text_iter_get_char(&start) != ' ') {
gtk_text_iter_forward_char(&start);
@@ -822,20 +785,6 @@
#endif /* USE_GREGEX */
}
-/* Prepare the buffer for sending with DelSp=Yes. */
-void
-libbalsa_prepare_delsp(GtkTextBuffer * buffer)
-{
- GtkTextTagTable *table = gtk_text_buffer_get_tag_table(buffer);
- GtkTextTag *soft_tag = gtk_text_tag_table_lookup(table, "soft");
- GtkTextIter iter;
-
- gtk_text_buffer_get_start_iter(buffer, &iter);
- while (gtk_text_iter_forward_to_line_end(&iter))
- if (gtk_text_iter_has_tag(&iter, soft_tag))
- gtk_text_buffer_insert(buffer, &iter, " ", 1);
-}
-
/*
* End of wrap/unwrap view.
*/
Modified: trunk/libbalsa/misc.h
==============================================================================
--- trunk/libbalsa/misc.h (original)
+++ trunk/libbalsa/misc.h Sat Aug 23 13:26:42 2008
@@ -123,7 +123,6 @@
void libbalsa_wrap_view(GtkTextView * view, gint length);
void libbalsa_unwrap_buffer(GtkTextBuffer * buffer, GtkTextIter * iter,
gint lines);
-void libbalsa_prepare_delsp(GtkTextBuffer * buffer);
const char* libbalsa_set_charset(const gchar * charset);
const char* libbalsa_set_send_charset(const gchar * charset);
Modified: trunk/src/balsa-mime-widget-text.c
==============================================================================
--- trunk/src/balsa-mime-widget-text.c (original)
+++ trunk/src/balsa-mime-widget-text.c Sat Aug 23 13:26:42 2008
@@ -236,7 +236,6 @@
(gpointer)mime_body);
buffer = gtk_text_view_get_buffer(GTK_TEXT_VIEW(mw->widget));
- gtk_text_buffer_create_tag(buffer, "soft", NULL, NULL);
allocate_quote_colors(GTK_WIDGET(bm), balsa_app.quoted_color,
0, MAX_QUOTED_COLOR - 1);
#if USE_GREGEX
Modified: trunk/src/sendmsg-window.c
==============================================================================
--- trunk/src/sendmsg-window.c (original)
+++ trunk/src/sendmsg-window.c Sat Aug 23 13:26:42 2008
@@ -3206,7 +3206,6 @@
bsmsg->buffer2 =
gtk_text_buffer_new(gtk_text_buffer_get_tag_table(buffer));
#endif /* HAVE_GTKSOURCEVIEW */
- gtk_text_buffer_create_tag(buffer, "soft", NULL, NULL);
gtk_text_buffer_create_tag(buffer, "url", NULL, NULL);
gtk_text_view_set_editable(text_view, TRUE);
gtk_text_view_set_wrap_mode(text_view, GTK_WRAP_WORD_CHAR);
@@ -5497,8 +5496,7 @@
GtkTextIter start, end;
LibBalsaIdentity *ident = bsmsg->ident;
#if HAVE_GTKSOURCEVIEW
- GtkTextBuffer *buffer, *buffer2;
- GtkTextIter iter;
+ GtkTextBuffer *buffer;
#endif /* HAVE_GTKSOURCEVIEW */
message = libbalsa_message_new();
@@ -5551,30 +5549,19 @@
/* Get the text from the buffer. First make sure it's wrapped. */
/* Note: if bmsmg->flow, sw_wrap_body just uses
* libbalsa_unwrap_buffer to unwrap each paragraph, removing
- * whitespace before any hard newline, and does not really wrap the
+ * spaces before any hard newline, and does not really wrap the
* buffer. */
sw_wrap_body(bsmsg);
/* Copy it to buffer2, so we can change it without changing the
* display. */
#if HAVE_GTKSOURCEVIEW
buffer = gtk_text_view_get_buffer(GTK_TEXT_VIEW(bsmsg->text));
- buffer2 =
- gtk_text_buffer_new(gtk_text_buffer_get_tag_table(buffer));
gtk_text_buffer_get_bounds(buffer, &start, &end);
- gtk_text_buffer_get_start_iter(buffer2, &iter);
- gtk_text_buffer_insert_range(buffer2, &iter, &start, &end);
- if (bsmsg->flow)
- libbalsa_prepare_delsp(buffer2);
- gtk_text_buffer_get_bounds(buffer2, &start, &end);
- body->buffer = gtk_text_iter_get_text(&start, &end);
- g_object_unref(buffer2);
#else /* HAVE_GTKSOURCEVIEW */
sw_buffer_save(bsmsg);
- if (bsmsg->flow)
- libbalsa_prepare_delsp(bsmsg->buffer2);
gtk_text_buffer_get_bounds(bsmsg->buffer2, &start, &end);
- body->buffer = gtk_text_iter_get_text(&start, &end);
#endif /* HAVE_GTKSOURCEVIEW */
+ body->buffer = gtk_text_iter_get_text(&start, &end);
if (bsmsg->send_mp_alt)
body->html_buffer =
libbalsa_text_to_html(message->subj, body->buffer,
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]