aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorSrinivasa Ragavan <sragavan@src.gnome.org>2007-06-18 11:30:15 +0800
committerSrinivasa Ragavan <sragavan@src.gnome.org>2007-06-18 11:30:15 +0800
commit20f692fb88bfcad5557c2732c41e5b7977ffce21 (patch)
treedd309fd6017ad8822e06c798850c14e737cb3e69
parentebb5ac843e59f4115d6c966bf9ef63e1b7ff4d1f (diff)
downloadgsoc2013-evolution-20f692fb88bfcad5557c2732c41e5b7977ffce21.tar
gsoc2013-evolution-20f692fb88bfcad5557c2732c41e5b7977ffce21.tar.gz
gsoc2013-evolution-20f692fb88bfcad5557c2732c41e5b7977ffce21.tar.bz2
gsoc2013-evolution-20f692fb88bfcad5557c2732c41e5b7977ffce21.tar.lz
gsoc2013-evolution-20f692fb88bfcad5557c2732c41e5b7977ffce21.tar.xz
gsoc2013-evolution-20f692fb88bfcad5557c2732c41e5b7977ffce21.tar.zst
gsoc2013-evolution-20f692fb88bfcad5557c2732c41e5b7977ffce21.zip
** Fix for bug #330175
svn path=/trunk/; revision=33687
-rw-r--r--mail/ChangeLog8
-rw-r--r--mail/em-folder-view.c40
2 files changed, 47 insertions, 1 deletions
diff --git a/mail/ChangeLog b/mail/ChangeLog
index 35d41a507c..ffd9404b68 100644
--- a/mail/ChangeLog
+++ b/mail/ChangeLog
@@ -1,3 +1,11 @@
+2007-06-05 Milan Crha <mcrha@redhat.com>
+
+ ** Fix for bug #330175
+
+ * em-folder-view.c: (emfv_message_reply):
+ Added helper function html_contains_nonwhitespace which returns TRUE
+ if selected html text contains at least one non-space character.
+
2007-06-16 Srinivasa Ragavan <sragavan@novell.com>
** Add support for the Magic Space Bar.
diff --git a/mail/em-folder-view.c b/mail/em-folder-view.c
index b1a72f3be2..3fe1db0aea 100644
--- a/mail/em-folder-view.c
+++ b/mail/em-folder-view.c
@@ -1514,6 +1514,44 @@ emfv_message_post_reply (BonoboUIComponent *uic, void *data, const char *path)
em_utils_post_reply_to_message_by_uid (emfv->folder, emfv->list->cursor_uid);
}
+static gboolean
+html_contains_nonwhitespace (const char *html, gint len)
+{
+ const char *p;
+ gunichar c = 0;
+
+ if (!html || len<=0)
+ return FALSE;
+
+ p = html;
+
+ while (p && p - html < len) {
+ c = g_utf8_get_char (p);
+ if (!c)
+ break;
+
+ if (c == '<') {
+ /* skip until next '>' */
+ while (c = g_utf8_get_char (p), c && c != '>' && p - html < len)
+ p = g_utf8_next_char (p);
+ if (!c)
+ break;
+ }else if (c == '&') {
+ /* sequence '&nbsp;' is a space */
+ if (g_ascii_strncasecmp (p, "&nbsp;", 6) == 0)
+ p = p + 5;
+ else
+ break;
+ }else if (!g_unichar_isspace (c)) {
+ break;
+ }
+
+ p = g_utf8_next_char (p);
+ }
+
+ return p - html < len - 1 && c != 0;
+}
+
static void
emfv_message_reply(EMFolderView *emfv, int mode)
{
@@ -1528,7 +1566,7 @@ emfv_message_reply(EMFolderView *emfv, int mode)
if (gtk_html_command(((EMFormatHTML *)emfv->preview)->html, "is-selection-active")
&& (html = gtk_html_get_selection_html (((EMFormatHTML *)emfv->preview)->html, &len))
- && len && html[0]) {
+ && len && html[0] && html_contains_nonwhitespace (html, len)) {
CamelMimeMessage *msg, *src;
struct _camel_header_raw *header;