Am 04.03.10 16:01 schrieb(en) Mario Mikocevic:
minor annoyance -> copy/pasting parts of received e-mail with classic code remarks is impossible, remark signs are ommited in copy buffer
Actually, that's a real bug! E.g., sometimes, there is '}' in the quote regex, which makes copying C sources sometimes impossible. The attached patch does not omit the citation prefix from the buffer, but displays it in a /very/ small (invisible) size. Works now with Emacs, gedit and OpenOffice. Setting the size to 0.0 doesn't work, btw - then all cited stuff disappears. Opinions? Best, Albrecht.
diff --git a/src/balsa-mime-widget-text.c b/src/balsa-mime-widget-text.c
index 6da1eb3..6e121ce 100644
--- a/src/balsa-mime-widget-text.c
+++ b/src/balsa-mime-widget-text.c
@@ -268,6 +268,7 @@ balsa_mime_widget_new_text(BalsaMessage * bm, LibBalsaMessageBody * mime_body,
guint cite_start;
gint margin;
gdouble char_width;
+ GtkTextTag *invisible;
PangoContext *context = gtk_widget_get_pango_context(mw->widget);
PangoFontDescription *desc =
pango_context_get_font_description(context);
@@ -288,6 +289,9 @@ balsa_mime_widget_new_text(BalsaMessage * bm, LibBalsaMessageBody * mime_body,
"foreground", "red",
"underline", PANGO_UNDERLINE_SINGLE,
NULL);
+ invisible = gtk_text_buffer_create_tag(buffer, "hide-cite",
+ "size-points", (gdouble) 0.01,
+ NULL);
url_info.callback = url_found_cb;
url_info.callback_data = &url_list;
url_info.buffer_is_flowed = libbalsa_message_body_is_flowed(mime_body);
@@ -334,13 +338,23 @@ balsa_mime_widget_new_text(BalsaMessage * bm, LibBalsaMessageBody * mime_body,
}
/* skip the citation prefix */
+ tag = quote_tag(buffer, quote_level, margin);
if (quote_level) {
- line_start += cite_idx;
- if (line_start < line_end
- && g_unichar_isspace(g_utf8_get_char(line_start)))
- line_start = g_utf8_next_char(line_start);
+ GtkTextIter cite_iter;
+ const gchar *cite_end;
+
+ gtk_text_buffer_get_iter_at_mark(buffer, &cite_iter,
+ gtk_text_buffer_get_insert(buffer));
+ cite_end = line_start + cite_idx;
+ if (cite_end < line_end
+ && g_unichar_isspace(g_utf8_get_char(cite_end)))
+ line_start = g_utf8_next_char(cite_end);
+ gtk_text_buffer_insert_with_tags(buffer, &cite_iter,
+ line_start,
+ cite_end - line_start,
+ tag, invisible, NULL);
+ line_start = cite_end;
}
- tag = quote_tag(buffer, quote_level, margin);
}
len = line_end - line_start;
Attachment:
pgpiZrSI5yzwK.pgp
Description: PGP signature