From aeebfea8529de1f30924ce82bd7a8f4e8038a930 Mon Sep 17 00:00:00 2001 From: Chris Jones Date: Sun, 13 Jul 2008 23:16:19 +0100 Subject: [PATCH] revert revision 442. LP #245291 isn't sanely fixable by us. vte needs to expose which regexp library it is using --- terminatorlib/terminatorterm.py | 23 +++++++++++------------ 1 file changed, 11 insertions(+), 12 deletions(-) diff --git a/terminatorlib/terminatorterm.py b/terminatorlib/terminatorterm.py index 97d651e1..ecab2db8 100755 --- a/terminatorlib/terminatorterm.py +++ b/terminatorlib/terminatorterm.py @@ -318,7 +318,7 @@ text/plain pos = "bottom" return pos - def add_matches (self): + def add_matches (self, lboundry="[[:<:]]", rboundry="[[:>:]]"): userchars = "-A-Za-z0-9" passchars = "-A-Za-z0-9,?;.:/!%$^*&~\"#'" hostchars = "-A-Za-z0-9" @@ -326,18 +326,17 @@ text/plain schemes = "(news:|telnet:|nntp:|file:/|https?:|ftps?:|webcal:)" user = "[" + userchars + "]+(:[" + passchars + "]+)?" urlpath = "/[" + pathchars + "]*[^]'.}>) \t\r\n,\\\"]" - - if platform.system() != 'FreeBSD': - lboundary = "\\<" - rboundary = "\\>" - else: - lboundary = "[[:<:]]" - rboundary = "[[:>:]]" - self.matches['full_uri'] = self._vte.match_add(lboundary + schemes + "//(" + user + "@)?[" + hostchars +".]+(:[0-9]+)?(" + urlpath + ")?" + rboundary + "/?") - self.matches['addr_only'] = self._vte.match_add (lboundary + "(www|ftp)[" + hostchars + "]*\.[" + hostchars + ".]+(:[0-9]+)?(" + urlpath + ")?" + rboundary + "/?") - self.matches['email'] = self._vte.match_add (lboundary + "(mailto:)?[a-zA-Z0-9][a-zA-Z0-9.+-]*@[a-zA-Z0-9][a-zA-Z0-9-]*\.[a-zA-Z0-9][a-zA-Z0-9-]+[.a-zA-Z0-9-]*" + rboundary) - self.matches['nntp'] = self._vte.match_add (lboundary + '''news:[-A-Z\^_a-z{|}~!"#$%&'()*+,./0-9;:=?`]+@[-A-Za-z0-9.]+(:[0-9]+)?''' + rboundary) + self.matches['full_uri'] = self._vte.match_add(lboundry + schemes + "//(" + user + "@)?[" + hostchars +".]+(:[0-9]+)?(" + urlpath + ")?" + rboundry + "/?") + + # FreeBSD works with [[:<:]], Linux works with \< + if self.matches['full_uri'] == -1: + if lboundry != "\\<": + self.add_matches(lboundry = "\\<", rboundry = "\\>") + else: + self.matches['addr_only'] = self._vte.match_add (lboundry + "(www|ftp)[" + hostchars + "]*\.[" + hostchars + ".]+(:[0-9]+)?(" + urlpath + ")?" + rboundry + "/?") + self.matches['email'] = self._vte.match_add (lboundry + "(mailto:)?[a-zA-Z0-9][a-zA-Z0-9.+-]*@[a-zA-Z0-9][a-zA-Z0-9-]*\.[a-zA-Z0-9][a-zA-Z0-9-]+[.a-zA-Z0-9-]*" + rboundry) + self.matches['nntp'] = self._vte.match_add (lboundry + '''news:[-A-Z\^_a-z{|}~!"#$%&'()*+,./0-9;:=?`]+@[-A-Za-z0-9.]+(:[0-9]+)?''' + rboundry) def spawn_child (self, event=None): update_records = self.conf.update_records