[evolution/gnome-3-30] Bug 750636 - Wrapped line should not start with a space ][
- From: Milan Crha <mcrha src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [evolution/gnome-3-30] Bug 750636 - Wrapped line should not start with a space ][
- Date: Wed, 12 Sep 2018 11:55:57 +0000 (UTC)
commit f9ceddb667dd726aac7e2ac5bc928035bb2656ae
Author: Milan Crha <mcrha redhat com>
Date: Tue Sep 4 18:33:40 2018 +0200
Bug 750636 - Wrapped line should not start with a space ][
Missed a case when the wrapped text is an anchor.
Closes https://bugzilla.gnome.org/show_bug.cgi?id=750636
src/e-util/test-html-editor-units-bugs.c | 36 +++++++++++++++++++---
.../web-extension/e-editor-dom-functions.c | 27 ++++++++++++++++
2 files changed, 59 insertions(+), 4 deletions(-)
---
diff --git a/src/e-util/test-html-editor-units-bugs.c b/src/e-util/test-html-editor-units-bugs.c
index e18f21a354..3837927657 100644
--- a/src/e-util/test-html-editor-units-bugs.c
+++ b/src/e-util/test-html-editor-units-bugs.c
@@ -1097,7 +1097,7 @@ test_bug_788829 (TestFixture *fixture)
"(!), xxxxxxx à xxx, xxxx ooo$ XXX<br>> xxxxé: <br>> <a href=\"https://xxxxx"
"xxxxxxxxxxx.xx/xxxxxxx/xxxxx-xxxx-xxxxxxxx-xxxxx-xxxx-xxx-xxxxxxxx-xxx/\">https://"
"xxxxxxxxxxxxxxxx.xx/xxxxxxx/xxxxx-xxxx-xxxxxxxx-xxxxx-xxxx-xxx-xxxxxxxx-xxx/</a><br>"
- "> xx xx xxxx xéxéxxxxxxx x'xxxxxx xxxx xx xxxxxx xx xxxxxxxxxxxx xx<br>> xxx ("
+ "> xx xx xxxx xéxéxxxxxxx x'xxxxxx xxxx xx xxxxxx xx xxxxxxxxxxxx xx xxx<br>> ("
"xxxxx Xxxxxx) xxxx xxxx x'xxxxxxx xx xxxxxx: <br>> <a href=\"https://xxxxxxxxxxxxxx"
"xx.xxx/xx-xxxxxxx/xxxxxxx/Xxxxxxxxxxxx-Xxxxx-Xxxx-XXX-Xxxxxx-Xxx.xxx\">https://xxxxxx"
"xxxxxxxxxx.xxx/xx-xxxxxxx/xxxxxxx/Xxxxxxxxxxxx-Xxxxx-Xxxx-XXX-Xxxxxx-Xxx.xxx</a></div>"
@@ -1129,8 +1129,8 @@ test_bug_788829 (TestFixture *fixture)
"> Xxxx xx xéxxxxxxx, xxxxxxxx xxxxxxx (!), xxxxxxx à xxx, xxxx ooo$ XXX\n"
"> xxxxé: \n"
"> https://xxxxxxxxxxxxxxxx.xx/xxxxxxx/xxxxx-xxxx-xxxxxxxx-xxxxx-xxxx-xxx-xxxxxxxx-xxx/\n"
- "> xx xx xxxx xéxéxxxxxxx x'xxxxxx xxxx xx xxxxxx xx xxxxxxxxxxxx xx\n"
- "> xxx (xxxxx Xxxxxx) xxxx xxxx x'xxxxxxx xx xxxxxx: \n"
+ "> xx xx xxxx xéxéxxxxxxx x'xxxxxx xxxx xx xxxxxx xx xxxxxxxxxxxx xx xxx\n"
+ "> (xxxxx Xxxxxx) xxxx xxxx x'xxxxxxx xx xxxxxx: \n"
">
https://xxxxxxxxxxxxxxxx.xxx/xx-xxxxxxx/xxxxxxx/Xxxxxxxxxxxx-Xxxxx-Xxxx-XXX-Xxxxxx-Xxx.xxx\n"
"> \n"
"> Xxxx xxx xxx xxxxxxx xxxxxxxéxx x'xxxêxxxx à xxxxx, xxx xx xxxxé xx\n"
@@ -1169,6 +1169,12 @@ test_bug_750636 (TestFixture *fixture)
" 1\\n"
" 2\\n"
" 3\\n"
+ "\\n"
+ "prefix text
https://www.gnome.org/1234567890123456789012345678901234567890123456789012345678901234567890 after text\\n"
+ "prefix text https://www.gnome.org/123456789012345678901234567890123 after text\\n"
+ "prefix text https://www.gnome.org/12345678901234567890
https://www.gnome.org/12345678901234567890 after text\\n"
+ "prefix text
https://www.gnome.org/1234567890123456789012345678901234567890123456789012345678901234567890\\n"
+ " next line text\\n"
"\n",
HTML_PREFIX "<div style=\"width: 71ch;\">"
"12345678901234567890123456789012345678901234567890123456789012345678901"
@@ -1188,6 +1194,17 @@ test_bug_750636 (TestFixture *fixture)
"<div style=\"width: 71ch;\"> 2</div>"
"<div style=\"width: 71ch;\"> 3</div>"
"<div style=\"width: 71ch;\"><br></div>"
+ "<div style=\"width: 71ch;\">prefix text <a
href=\"https://www.gnome.org/1234567890123456789012345678901234567890123456789012345678901234567890\">"
+
"https://www.gnome.org/1234567890123456789012345678901234567890123456789012345678901234567890</a> after
text</div>"
+ "<div style=\"width: 71ch;\">prefix text <a
href=\"https://www.gnome.org/123456789012345678901234567890123\">"
+ "https://www.gnome.org/123456789012345678901234567890123</a> after text</div>"
+ "<div style=\"width: 71ch;\">prefix text <a
href=\"https://www.gnome.org/12345678901234567890\">"
+ "https://www.gnome.org/12345678901234567890</a> <a
href=\"https://www.gnome.org/12345678901234567890\">"
+ "https://www.gnome.org/12345678901234567890</a> after text</div>"
+ "<div style=\"width: 71ch;\">prefix text <a
href=\"https://www.gnome.org/1234567890123456789012345678901234567890123456789012345678901234567890\">"
+
"https://www.gnome.org/1234567890123456789012345678901234567890123456789012345678901234567890</a></div>"
+ "<div style=\"width: 71ch;\"> next line text</div>"
+ "<div style=\"width: 71ch;\"><br></div>"
HTML_SUFFIX,
"12345678901234567890123456789012345678901234567890123456789012345678901\n"
"12345678901234567890123456789012345678901234567890123456789012345678901\n"
@@ -1204,7 +1221,18 @@ test_bug_750636 (TestFixture *fixture)
" F\n\n"
" 1\n"
" 2\n"
- " 3\n"))
+ " 3\n"
+ "\n"
+ "prefix text \n"
+
"https://www.gnome.org/1234567890123456789012345678901234567890123456789012345678901234567890\n"
+ "after text\n"
+ "prefix text https://www.gnome.org/123456789012345678901234567890123\n"
+ "after text\n"
+ "prefix text https://www.gnome.org/12345678901234567890 \n"
+ "https://www.gnome.org/12345678901234567890 after text\n"
+ "prefix text \n"
+
"https://www.gnome.org/1234567890123456789012345678901234567890123456789012345678901234567890\n"
+ " next line text\n"))
g_test_fail ();
}
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 1d7beecdb7..ff92ddc9c2 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
@@ -14169,6 +14169,33 @@ wrap_lines (EEditorPage *editor_page,
}
node = next_sibling;
+
+ if (!line_length && WEBKIT_DOM_IS_TEXT (node)) {
+ gchar *nd_content;
+
+ while (nd_content = webkit_dom_node_get_text_content (node),
nd_content) {
+ gboolean changed = FALSE;
+
+ if (*nd_content) {
+ if (*nd_content == ' ') {
+ mark_and_remove_leading_space (document,
node);
+ changed = TRUE;
+ }
+
+ if (!webkit_dom_node_get_next_sibling (node) &&
+ g_str_has_suffix (nd_content, " ")) {
+ mark_and_remove_trailing_space (document,
node);
+ changed = TRUE;
+ }
+ }
+
+ g_free (nd_content);
+
+ if (!changed)
+ break;
+ }
+ }
+
continue;
}
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]