[evolution] I#1394 - Composer: Incorrect wrap in citation with a long link
- From: Milan Crha <mcrha src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [evolution] I#1394 - Composer: Incorrect wrap in citation with a long link
- Date: Tue, 9 Mar 2021 12:34:56 +0000 (UTC)
commit 1f07a428f3203c3cc6c912eada48afa2dd531354
Author: Milan Crha <mcrha redhat com>
Date: Tue Mar 9 13:32:39 2021 +0100
I#1394 - Composer: Incorrect wrap in citation with a long link
Closes https://gitlab.gnome.org/GNOME/evolution/-/issues/1394
data/webkit/e-editor.js | 10 +--
src/e-util/test-html-editor-units-bugs.c | 104 +++++++++++++++++++++++++++++++
2 files changed, 110 insertions(+), 4 deletions(-)
---
diff --git a/data/webkit/e-editor.js b/data/webkit/e-editor.js
index b5501a03df..9951e11807 100644
--- a/data/webkit/e-editor.js
+++ b/data/webkit/e-editor.js
@@ -1814,11 +1814,13 @@ EvoEditor.getNextNodeInHierarchy = function(node, upToNode)
EvoEditor.quoteParagraphWrap = function(node, lineLength, wrapWidth, prefixHtml)
{
if (node.nodeType == node.ELEMENT_NODE) {
- var br = document.createElement("BR");
- br.className = "-x-evo-wrap-br";
+ if (lineLength > 0) {
+ var br = document.createElement("BR");
+ br.className = "-x-evo-wrap-br";
- node.insertAdjacentElement("beforebegin", br);
- node.insertAdjacentHTML("beforebegin", prefixHtml);
+ node.insertAdjacentElement("beforebegin", br);
+ node.insertAdjacentHTML("beforebegin", prefixHtml);
+ }
return node.innerText.length;
}
diff --git a/src/e-util/test-html-editor-units-bugs.c b/src/e-util/test-html-editor-units-bugs.c
index 9783de9c3c..7905a2cfd4 100644
--- a/src/e-util/test-html-editor-units-bugs.c
+++ b/src/e-util/test-html-editor-units-bugs.c
@@ -2401,6 +2401,109 @@ test_issue_1391 (TestFixture *fixture)
g_test_fail ();
}
+static gboolean
+test_issue_1394_with_wrap_length (TestFixture *fixture,
+ gint wrap_length)
+{
+ gchar *html;
+
+ test_utils_fixture_change_setting_int32 (fixture, "org.gnome.evolution.mail",
"composer-word-wrap-length", wrap_length);
+
+ if (!test_utils_process_commands (fixture,
+ "mode:plain\n"))
+ return FALSE;
+
+ test_utils_insert_content (fixture,
+ "<body><div>a</div>"
+ "<blockquote type=\"cite\">"
+ "<div>b</div>"
+ "<div><a href=\"https://www.example.com/\">https://www.example.com/</a></div>"
+ "<div>c</div>"
+ "</blockquote>"
+ "<div><br></div>"
+ "<span class=\"-x-evo-to-body\" data-credits=\"Credits:\"></span>"
+ "<span class=\"-x-evo-cite-body\"></span></body>",
+ E_CONTENT_EDITOR_INSERT_REPLACE_ALL | E_CONTENT_EDITOR_INSERT_TEXT_HTML);
+
+ html = g_strdup_printf (
+ HTML_PREFIX "<div style=\"width: %dch;\">Credits:</div>"
+ "<blockquote type=\"cite\">"
+ "<blockquote type=\"cite\">"
+ "<div>" QUOTE_SPAN (QUOTE_CHR QUOTE_CHR) "<a
href=\"https://www.example.com/\">https://www.example.com/</a></div>"
+ "<div>" QUOTE_SPAN (QUOTE_CHR QUOTE_CHR) "c</div>"
+ "</blockquote>"
+ "<div>" QUOTE_SPAN (QUOTE_CHR) "<br></div>"
+ "</blockquote>"
+ HTML_SUFFIX,
+ wrap_length);
+
+ if (!test_utils_run_simple_test (fixture,
+ "undo:save\n"
+ "seq:dddSllllsb\n",
+ html,
+ "Credits:\n"
+ "> > https://www.example.com/\n"
+ "> > c\n"
+ "> \n")) {
+ g_free (html);
+ return FALSE;
+ }
+
+ g_free (html);
+
+ if (!test_utils_process_commands (fixture,
+ "undo:save\n"
+ "undo:undo\n"
+ "undo:test:2\n"
+ "undo:redo\n"
+ "undo:test\n"
+ "undo:drop:2"))
+ return FALSE;
+
+ html = g_strdup_printf (
+ HTML_PREFIX "<div style=\"width: %dch;\">Credits:<a
href=\"https://www.example.com/\">https://www.example.com/</a></div>"
+ "<blockquote type=\"cite\">"
+ "<blockquote type=\"cite\">"
+ "<div>" QUOTE_SPAN (QUOTE_CHR QUOTE_CHR) "c</div>"
+ "</blockquote>"
+ "<div>" QUOTE_SPAN (QUOTE_CHR) "<br></div>"
+ "</blockquote>"
+ HTML_SUFFIX,
+ wrap_length);
+
+ if (!test_utils_run_simple_test (fixture,
+ "undo:save\n"
+ "seq:b\n",
+ html,
+ "Credits:https://www.example.com/\n"
+ "> > c\n"
+ "> \n")) {
+ g_free (html);
+ return FALSE;
+ }
+
+ g_free (html);
+
+ if (!test_utils_process_commands (fixture,
+ "undo:save\n"
+ "undo:undo\n"
+ "undo:test:2\n"
+ "undo:redo\n"
+ "undo:test\n"
+ "undo:drop:2"))
+ return FALSE;
+
+ return TRUE;
+}
+
+static void
+test_issue_1394 (TestFixture *fixture)
+{
+ if (!test_issue_1394_with_wrap_length (fixture, 50) ||
+ !test_issue_1394_with_wrap_length (fixture, 10))
+ g_test_fail ();
+}
+
void
test_add_html_editor_bug_tests (void)
{
@@ -2443,4 +2546,5 @@ test_add_html_editor_bug_tests (void)
test_utils_add_test ("/issue/1365", test_issue_1365);
test_utils_add_test ("/issue/1344", test_issue_1344);
test_utils_add_test ("/issue/1391", test_issue_1391);
+ test_utils_add_test ("/issue/1394", test_issue_1394);
}
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]