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