From 685a6b29e8e6bc3787405c562a9cb514cb9810f8 Mon Sep 17 00:00:00 2001 From: Packit Service Date: Nov 30 2020 18:13:52 +0000 Subject: Apply patch evolution-3.28.5-extra-new-line-before-url.patch patch_name: evolution-3.28.5-extra-new-line-before-url.patch present_in_specfile: true --- diff --git a/src/e-util/test-html-editor-units-bugs.c b/src/e-util/test-html-editor-units-bugs.c index 071be22..a4fbfe0 100644 --- a/src/e-util/test-html-editor-units-bugs.c +++ b/src/e-util/test-html-editor-units-bugs.c @@ -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 "
before
" + "
" LONG_URL "
" + "
after
" + "
prefix text " SHORTER_URL " suffix
" + "
prefix " SHORT_URL " suffix
" + "
end
" + 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 --git a/src/modules/webkit-editor/web-extension/e-editor-dom-functions.c b/src/modules/webkit-editor/web-extension/e-editor-dom-functions.c index 87bc86e..3568f6e 100644 --- a/src/modules/webkit-editor/web-extension/e-editor-dom-functions.c +++ b/src/modules/webkit-editor/web-extension/e-editor-dom-functions.c @@ -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
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");