[evolution] EHTMLEditorView - Don't include non-breaking space while recognizing links



commit 75ccfa224eb36138c9794dbc69b07db4878e6fca
Author: Tomas Popela <tpopela redhat com>
Date:   Fri Dec 4 14:15:07 2015 +0100

    EHTMLEditorView - Don't include non-breaking space while recognizing links
    
    Follow-up fix after commit 127c778 as the previous change was accepting only
    links with non-breaking space. Fix that and also don't save unneeded matches.

 e-util/e-html-editor-view.c |    6 ++++--
 1 files changed, 4 insertions(+), 2 deletions(-)
---
diff --git a/e-util/e-html-editor-view.c b/e-util/e-html-editor-view.c
index da2f055..80f1211 100644
--- a/e-util/e-html-editor-view.c
+++ b/e-util/e-html-editor-view.c
@@ -37,8 +37,10 @@
 
 /* stephenhay from https://mathiasbynens.be/demo/url-regex */
 #define URL_PROTOCOLS "news|telnet|nntp|file|https?|s?ftp||webcal|localhost|ssh"
-#define URL_PATTERN "((((" URL_PROTOCOLS ")\\:\\/\\/)|(www\\.|ftp\\.))[^\\s\\/\\$\\.\\?#].[^\\s]*)(?=&nbsp;)"
-#define URL_PATTERN_SPACE URL_PATTERN "\\s"
+#define URL_PATTERN_BASE "(?=((?:(?:(?:" URL_PROTOCOLS 
")\\:\\/\\/)|(?:www\\.|ftp\\.))[^\\s\\/\\$\\.\\?#].[^\\s]*)"
+#define URL_PATTERN_NO_NBSP ")((?!&nbsp;).)*"
+#define URL_PATTERN URL_PATTERN_BASE URL_PATTERN_NO_NBSP
+#define URL_PATTERN_SPACE URL_PATTERN_BASE "\\s$" URL_PATTERN_NO_NBSP
 /* Taken from camel-url-scanner.c */
 #define URL_INVALID_TRAILING_CHARS ",.:;?!-|}])\""
 


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