aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorSrinivasa Ragavan <sragavan@src.gnome.org>2007-06-18 11:32:08 +0800
committerSrinivasa Ragavan <sragavan@src.gnome.org>2007-06-18 11:32:08 +0800
commita872b0e67e4ed760693bc0a686c0104a4663974f (patch)
tree3cdaabaa679a7100f089ead5913546a7935b3167
parent9b1eb8a7504203b400234b01e7dcb0d369551bc4 (diff)
downloadgsoc2013-evolution-a872b0e67e4ed760693bc0a686c0104a4663974f.tar
gsoc2013-evolution-a872b0e67e4ed760693bc0a686c0104a4663974f.tar.gz
gsoc2013-evolution-a872b0e67e4ed760693bc0a686c0104a4663974f.tar.bz2
gsoc2013-evolution-a872b0e67e4ed760693bc0a686c0104a4663974f.tar.lz
gsoc2013-evolution-a872b0e67e4ed760693bc0a686c0104a4663974f.tar.xz
gsoc2013-evolution-a872b0e67e4ed760693bc0a686c0104a4663974f.tar.zst
gsoc2013-evolution-a872b0e67e4ed760693bc0a686c0104a4663974f.zip
** Fix for bug #330175
svn path=/branches/gnome-2-18/; revision=33688
-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 081826c965..4c6f0725f9 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-02 Ross Burton <ross@openedhand.com>
* mail-send-recv.c:
diff --git a/mail/em-folder-view.c b/mail/em-folder-view.c
index 6b26843b06..693c04c9ef 100644
--- a/mail/em-folder-view.c
+++ b/mail/em-folder-view.c
@@ -1491,6 +1491,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)
{
@@ -1505,7 +1543,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;