--- /home/arch/gtg-bzr/src/trunk/GTG/tools/urlregex.py 2012-01-07 16:49:15.333116000 +0100 +++ tools/urlregex.py 2012-01-07 20:22:07.182531007 +0100 @@ -38,9 +38,14 @@ PATH_ENDING_CHARS = r'[%s\)=#/]' % UTF_CHARS QUERY_ENDING_CHARS = '[a-z0-9_&=#]' -URL_REGEX = re.compile('((%s)((https?://|www\\.)(%s)(\/%s*%s?)?(\?%s*%s)?))' - % (PRE_CHARS, DOMAIN_CHARS, PATH_CHARS, - PATH_ENDING_CHARS, QUERY_CHARS, QUERY_ENDING_CHARS), - re.IGNORECASE) +subst_dict = {"pre":PRE_CHARS, "domain":DOMAIN_CHARS, "path":PATH_CHARS, + "path_end":PATH_ENDING_CHARS, "query":QUERY_CHARS, + "query_end":QUERY_ENDING_CHARS} + +HTTP_URI='((%(pre)s)((https?://|www\\.)(%(domain)s)(\/%(path)s*%(path_end)s?)?(\?%(query)s*%(query_end)s)?))' % subst_dict +FILE_URI='(file:///(%(path)s*%(path_end)s?)?)' % subst_dict + +URL_REGEX = re.compile('%s|%s' % (HTTP_URI, FILE_URI), re.IGNORECASE) + def match(text): return re.match(URL_REGEX, text) --- /home/arch/gtg-bzr/src/trunk/GTG/gtk/editor/taskview.py 2012-01-07 20:27:38.928277000 +0100 +++ gtk/editor/taskview.py 2012-01-07 20:23:25.015442685 +0100 @@ -560,7 +560,7 @@ prev.backward_word_start() text = buff.get_text(prev,it) - if text in ["http","https","www"]: + if text in ["http","https","www","file"]: isurl = buff.get_text(prev, buff.get_end_iter()) m = urlregex.match(isurl) if m is not None: