evolution/SOURCES/evolution-3.28.5-extra-new-line-before-url.patch
2021-10-08 10:50:56 +00:00

67 lines
2.9 KiB
Diff

diff -up evolution-3.28.5/src/e-util/test-html-editor-units-bugs.c.extra-new-line-before-url evolution-3.28.5/src/e-util/test-html-editor-units-bugs.c
--- evolution-3.28.5/src/e-util/test-html-editor-units-bugs.c.extra-new-line-before-url 2018-09-03 15:40:14.491506323 +0200
+++ evolution-3.28.5/src/e-util/test-html-editor-units-bugs.c 2018-09-03 15:40:14.494506323 +0200
@@ -1319,6 +1319,44 @@ test_issue_86 (TestFixture *fixture)
g_free (converted);
}
+static void
+test_issue_103 (TestFixture *fixture)
+{
+ #define LONG_URL "https://www.example.com/123456789012345678901234567890123456789012345678901234567890"
+ #define SHORTER_URL "https://www.example.com/1234567890123456789012345678901234567890"
+ #define SHORT_URL "https://www.example.com/"
+
+ if (!test_utils_run_simple_test (fixture,
+ "mode:plain\n"
+ "type:before\\n"
+ LONG_URL "\\n"
+ "after\\n"
+ "prefix text " SHORTER_URL " suffix\\n"
+ "prefix " SHORT_URL " suffix\\n"
+ "end\n",
+ HTML_PREFIX "<div style=\"width: 71ch;\">before</div>"
+ "<div style=\"width: 71ch;\"><a href=\"" LONG_URL "\">" LONG_URL "</a></div>"
+ "<div style=\"width: 71ch;\">after</div>"
+ "<div style=\"width: 71ch;\">prefix text <a href=\"" SHORTER_URL "\">" SHORTER_URL "</a> suffix</div>"
+ "<div style=\"width: 71ch;\">prefix <a href=\"" SHORT_URL "\">" SHORT_URL "</a> suffix</div>"
+ "<div style=\"width: 71ch;\">end</div>"
+ HTML_SUFFIX,
+ "before\n"
+ LONG_URL "\n"
+ "after\n"
+ "prefix text \n"
+ SHORTER_URL " suffix\n"
+ "prefix " SHORT_URL " suffix\n"
+ "end")) {
+ g_test_fail ();
+ return;
+ }
+
+ #undef SHORT_URL
+ #undef SHORTER_URL
+ #undef LONG_URL
+}
+
void
test_add_html_editor_bug_tests (void)
{
@@ -1349,4 +1387,5 @@ test_add_html_editor_bug_tests (void)
test_utils_add_test ("/bug/788829", test_bug_788829);
test_utils_add_test ("/bug/750636", test_bug_750636);
test_utils_add_test ("/issue/86", test_issue_86);
+ test_utils_add_test ("/issue/103", test_issue_103);
}
diff -up evolution-3.28.5/src/modules/webkit-editor/web-extension/e-editor-dom-functions.c.extra-new-line-before-url evolution-3.28.5/src/modules/webkit-editor/web-extension/e-editor-dom-functions.c
--- evolution-3.28.5/src/modules/webkit-editor/web-extension/e-editor-dom-functions.c.extra-new-line-before-url 2018-09-03 15:40:14.493506323 +0200
+++ evolution-3.28.5/src/modules/webkit-editor/web-extension/e-editor-dom-functions.c 2018-09-03 15:40:14.496506323 +0200
@@ -14089,7 +14089,7 @@ wrap_lines (EEditorPage *editor_page,
next_sibling = webkit_dom_node_get_next_sibling (node);
/* If the anchor doesn't fit on the line, add it to a separate line. */
- if ((line_length + anchor_length) > length_to_wrap) {
+ if (line_length > 0 && (line_length + anchor_length) > length_to_wrap) {
/* Put <BR> before the anchor, thus it starts on a new line */
element = webkit_dom_document_create_element (document, "BR", NULL);
element_add_class (element, "-x-evo-wrap-br");