Blame SOURCES/evolution-3.8.5-reply-with-selection.patch

7c6d83
diff -up evolution-3.8.5/e-util/e-web-view.c.reply-with-selection evolution-3.8.5/e-util/e-web-view.c
7c6d83
--- evolution-3.8.5/e-util/e-web-view.c.reply-with-selection	2014-07-23 17:47:43.318792162 +0200
7c6d83
+++ evolution-3.8.5/e-util/e-web-view.c	2014-07-23 17:47:43.327792161 +0200
7c6d83
@@ -2569,6 +2569,27 @@ e_web_view_update_actions (EWebView *web
7c6d83
 	g_signal_emit (web_view, signals[UPDATE_ACTIONS], 0);
7c6d83
 }
7c6d83
 
7c6d83
+static gboolean
7c6d83
+element_is_in_pre_tag (WebKitDOMNode *node)
7c6d83
+{
7c6d83
+	WebKitDOMElement *element;
7c6d83
+
7c6d83
+	if (!node)
7c6d83
+		return FALSE;
7c6d83
+
7c6d83
+	while (element = webkit_dom_node_get_parent_element (node), element) {
7c6d83
+		node = WEBKIT_DOM_NODE (element);
7c6d83
+
7c6d83
+		if (WEBKIT_DOM_IS_HTML_PRE_ELEMENT (element)) {
7c6d83
+			return TRUE;
7c6d83
+		} else if (WEBKIT_DOM_IS_HTML_IFRAME_ELEMENT (element)) {
7c6d83
+			break;
7c6d83
+		}
7c6d83
+	}
7c6d83
+
7c6d83
+	return FALSE;
7c6d83
+}
7c6d83
+
7c6d83
 static gchar *
7c6d83
 web_view_get_frame_selection_html (WebKitDOMElement *iframe)
7c6d83
 {
7c6d83
@@ -2589,6 +2610,9 @@ web_view_get_frame_selection_html (WebKi
7c6d83
 
7c6d83
 		range = webkit_dom_dom_selection_get_range_at (selection, 0, NULL);
7c6d83
 		if (range != NULL) {
7c6d83
+			gchar *inner_html;
7c6d83
+			WebKitDOMNode *node;
7c6d83
+
7c6d83
 			fragment = webkit_dom_range_clone_contents (
7c6d83
 				range, NULL);
7c6d83
 
7c6d83
@@ -2598,8 +2622,16 @@ web_view_get_frame_selection_html (WebKi
7c6d83
 				WEBKIT_DOM_NODE (element),
7c6d83
 				WEBKIT_DOM_NODE (fragment), NULL);
7c6d83
 
7c6d83
-			return webkit_dom_html_element_get_inner_html (
7c6d83
+			inner_html = webkit_dom_html_element_get_inner_html (
7c6d83
 				WEBKIT_DOM_HTML_ELEMENT (element));
7c6d83
+			node = webkit_dom_range_get_start_container (range, NULL);
7c6d83
+			if (element_is_in_pre_tag (node)) {
7c6d83
+				gchar *tmp = inner_html;
7c6d83
+				inner_html = g_strconcat ("
", tmp, "
", NULL);
7c6d83
+				g_free (tmp);
7c6d83
+			}
7c6d83
+
7c6d83
+			return inner_html;
7c6d83
 		}
7c6d83
 	}
7c6d83