[evolution] Bug 744218 - Cannot move with arrow keys from top to bottom



commit 843e07ef0af6250cf1b470f0c0aebef072d2746e
Author: Tomas Popela <tpopela redhat com>
Date:   Tue Feb 10 09:36:31 2015 +0100

    Bug 744218 - Cannot move with arrow keys from top to bottom
    
    Insert BR that is used for wrapping after the long link just in case
    there is some node after it.

 e-util/e-html-editor-selection.c |    8 +++++---
 1 files changed, 5 insertions(+), 3 deletions(-)
---
diff --git a/e-util/e-html-editor-selection.c b/e-util/e-html-editor-selection.c
index aeb4d39..fc3721f 100644
--- a/e-util/e-html-editor-selection.c
+++ b/e-util/e-html-editor-selection.c
@@ -5392,6 +5392,7 @@ wrap_lines (EHTMLEditorSelection *selection,
                        /* If element is ANCHOR we wrap it separately */
                        if (WEBKIT_DOM_IS_HTML_ANCHOR_ELEMENT (node)) {
                                glong anchor_length;
+                               WebKitDOMNode *next_sibling;
 
                                text_content = webkit_dom_node_get_text_content (node);
                                anchor_length = g_utf8_strlen (text_content, -1);
@@ -5411,21 +5412,22 @@ wrap_lines (EHTMLEditorSelection *selection,
                                } else
                                        len += anchor_length;
 
+                               next_sibling = webkit_dom_node_get_next_sibling (node);
                                /* If the anchor doesn't fit on the line wrap after it */
-                               if (anchor_length > word_wrap_length) {
+                               if (anchor_length > word_wrap_length && next_sibling) {
                                        element = webkit_dom_document_create_element (
                                                document, "BR", NULL);
                                        element_add_class (element, "-x-evo-wrap-br");
                                        node = webkit_dom_node_insert_before (
                                                webkit_dom_node_get_parent_node (node),
                                                WEBKIT_DOM_NODE (element),
-                                               webkit_dom_node_get_next_sibling (node),
+                                               next_sibling,
                                                NULL);
                                        len = 0;
                                }
                                /* If there is space after the anchor don't try to
                                 * wrap before it */
-                               node = webkit_dom_node_get_next_sibling (node);
+                               node = next_sibling;
                                if (WEBKIT_DOM_IS_TEXT (node)) {
                                        text_content = webkit_dom_node_get_text_content (node);
                                        if (g_str_has_prefix (text_content, " ")) {


[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]