[evolution] EHTMLEditorView - Allow to append a query to the link



commit c7ee4849a89584c028c7f8fcb964ae5f833b08a0
Author: Tomas Popela <tpopela redhat com>
Date:   Fri Nov 20 13:45:31 2015 +0100

    EHTMLEditorView - Allow to append a query to the link

 e-util/e-html-editor-view.c |   23 ++++++++++++++++-------
 1 files changed, 16 insertions(+), 7 deletions(-)
---
diff --git a/e-util/e-html-editor-view.c b/e-util/e-html-editor-view.c
index 1028729..a71b34a 100644
--- a/e-util/e-html-editor-view.c
+++ b/e-util/e-html-editor-view.c
@@ -1575,7 +1575,8 @@ html_editor_view_check_magic_links (EHTMLEditorView *view,
                        text_to_append = webkit_dom_node_get_text_content (node);
                        if (text_to_append && *text_to_append &&
                            !strstr (text_to_append, " ") &&
-                           !strchr (URL_INVALID_TRAILING_CHARS, *text_to_append) &&
+                           !(strchr (URL_INVALID_TRAILING_CHARS, *text_to_append) &&
+                             !(*text_to_append == '?' && strlen(text_to_append) > 1)) &&
                            !g_str_has_prefix (text_to_append, UNICODE_NBSP)) {
 
                                appending_to_link = TRUE;
@@ -2829,14 +2830,22 @@ body_input_event_cb (WebKitDOMElement *element,
 
                        text = webkit_dom_node_get_text_content (node);
 
-                       if (text && *text && !strstr (text, " ") &&
-                           !strchr (URL_INVALID_TRAILING_CHARS, *text)) {
-                               WebKitDOMNode *prev_sibling;
+                       if (text && *text && !strstr (text, " ")) {
+                               gboolean valid = FALSE;
 
-                               prev_sibling = webkit_dom_node_get_previous_sibling (node);
+                               if (*text == '?' && strlen (text) > 1)
+                                       valid = TRUE;
+                               else if (!strchr (URL_INVALID_TRAILING_CHARS, *text))
+                                       valid = TRUE;
 
-                               if (WEBKIT_DOM_IS_HTML_ANCHOR_ELEMENT (prev_sibling))
-                                       html_editor_view_check_magic_links (view, range, FALSE);
+                               if (valid) {
+                                       WebKitDOMNode *prev_sibling;
+
+                                       prev_sibling = webkit_dom_node_get_previous_sibling (node);
+
+                                       if (WEBKIT_DOM_IS_HTML_ANCHOR_ELEMENT (prev_sibling))
+                                               html_editor_view_check_magic_links (view, range, FALSE);
+                               }
                        }
                        g_free (text);
                }


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