Fix regex's needing MULTILINE flag to prevent libvte 0.44 throwing warnings
This commit is contained in:
parent
75f4abba49
commit
c7a6f88a57
|
@ -89,6 +89,7 @@ class Terminal(Gtk.VBox):
|
||||||
pid = None
|
pid = None
|
||||||
|
|
||||||
matches = None
|
matches = None
|
||||||
|
regex_flags = None
|
||||||
config = None
|
config = None
|
||||||
default_encoding = None
|
default_encoding = None
|
||||||
custom_encoding = None
|
custom_encoding = None
|
||||||
|
@ -142,6 +143,8 @@ class Terminal(Gtk.VBox):
|
||||||
self.vte.show()
|
self.vte.show()
|
||||||
|
|
||||||
self.default_encoding = self.vte.get_encoding()
|
self.default_encoding = self.vte.get_encoding()
|
||||||
|
self.regex_flags = (GLib.RegexCompileFlags.OPTIMIZE | \
|
||||||
|
GLib.RegexCompileFlags.MULTILINE)
|
||||||
self.update_url_matches()
|
self.update_url_matches()
|
||||||
|
|
||||||
self.terminalbox = self.create_terminalbox()
|
self.terminalbox = self.create_terminalbox()
|
||||||
|
@ -268,7 +271,7 @@ class Terminal(Gtk.VBox):
|
||||||
re = (lboundry + schemes +
|
re = (lboundry + schemes +
|
||||||
"//(" + user + "@)?[" + hostchars +".]+(:[0-9]+)?(" +
|
"//(" + user + "@)?[" + hostchars +".]+(:[0-9]+)?(" +
|
||||||
urlpath + ")?" + rboundry + "/?")
|
urlpath + ")?" + rboundry + "/?")
|
||||||
reg = GLib.Regex.new(re, GLib.RegexCompileFlags.OPTIMIZE, 0)
|
reg = GLib.Regex.new(re, self.regex_flags, 0)
|
||||||
self.matches['full_uri'] = self.vte.match_add_gregex(reg, 0)
|
self.matches['full_uri'] = self.vte.match_add_gregex(reg, 0)
|
||||||
|
|
||||||
if self.matches['full_uri'] == -1:
|
if self.matches['full_uri'] == -1:
|
||||||
|
@ -278,23 +281,23 @@ class Terminal(Gtk.VBox):
|
||||||
'(callto:|h323:|sip:)' + "[" + userchars + "+][" +
|
'(callto:|h323:|sip:)' + "[" + userchars + "+][" +
|
||||||
userchars + ".]*(:[0-9]+)?@?[" + pathchars + "]+" +
|
userchars + ".]*(:[0-9]+)?@?[" + pathchars + "]+" +
|
||||||
rboundry)
|
rboundry)
|
||||||
reg = GLib.Regex.new(re, GLib.RegexCompileFlags.OPTIMIZE, 0)
|
reg = GLib.Regex.new(re, self.regex_flags, 0)
|
||||||
self.matches['voip'] = self.vte.match_add_gregex(reg, 0)
|
self.matches['voip'] = self.vte.match_add_gregex(reg, 0)
|
||||||
re = (lboundry +
|
re = (lboundry +
|
||||||
"(www|ftp)[" + hostchars + "]*\.[" + hostchars +
|
"(www|ftp)[" + hostchars + "]*\.[" + hostchars +
|
||||||
".]+(:[0-9]+)?(" + urlpath + ")?" + rboundry + "/?")
|
".]+(:[0-9]+)?(" + urlpath + ")?" + rboundry + "/?")
|
||||||
reg = GLib.Regex.new(re, GLib.RegexCompileFlags.OPTIMIZE, 0)
|
reg = GLib.Regex.new(re, self.regex_flags, 0)
|
||||||
self.matches['addr_only'] = self.vte.match_add_gregex(reg, 0)
|
self.matches['addr_only'] = self.vte.match_add_gregex(reg, 0)
|
||||||
re = (lboundry +
|
re = (lboundry +
|
||||||
"(mailto:)?[a-zA-Z0-9][a-zA-Z0-9.+-]*@[a-zA-Z0-9]" +
|
"(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-]*\.[a-zA-Z0-9][a-zA-Z0-9-]+" +
|
||||||
"[.a-zA-Z0-9-]*" + rboundry)
|
"[.a-zA-Z0-9-]*" + rboundry)
|
||||||
reg = GLib.Regex.new(re, GLib.RegexCompileFlags.OPTIMIZE, 0)
|
reg = GLib.Regex.new(re, self.regex_flags, 0)
|
||||||
self.matches['email'] = self.vte.match_add_gregex(reg, 0)
|
self.matches['email'] = self.vte.match_add_gregex(reg, 0)
|
||||||
re = (lboundry +
|
re = (lboundry +
|
||||||
"""news:[-A-Z\^_a-z{|}~!"#$%&'()*+,./0-9;:=?`]+@""" +
|
"""news:[-A-Z\^_a-z{|}~!"#$%&'()*+,./0-9;:=?`]+@""" +
|
||||||
"[-A-Za-z0-9.]+(:[0-9]+)?" + rboundry)
|
"[-A-Za-z0-9.]+(:[0-9]+)?" + rboundry)
|
||||||
reg = GLib.Regex.new(re, GLib.RegexCompileFlags.OPTIMIZE, 0)
|
reg = GLib.Regex.new(re, self.regex_flags, 0)
|
||||||
self.matches['nntp'] = self.vte.match_add_gregex(reg, 0)
|
self.matches['nntp'] = self.vte.match_add_gregex(reg, 0)
|
||||||
|
|
||||||
# Now add any matches from plugins
|
# Now add any matches from plugins
|
||||||
|
@ -309,7 +312,7 @@ class Terminal(Gtk.VBox):
|
||||||
if name in self.matches:
|
if name in self.matches:
|
||||||
dbg('refusing to add duplicate match %s' % name)
|
dbg('refusing to add duplicate match %s' % name)
|
||||||
continue
|
continue
|
||||||
reg = GLib.Regex.new(match, GLib.RegexCompileFlags.OPTIMIZE, 0)
|
reg = GLib.Regex.new(match, self.regex_flags, 0)
|
||||||
self.matches[name] = self.vte.match_add_gregex(reg, 0)
|
self.matches[name] = self.vte.match_add_gregex(reg, 0)
|
||||||
dbg('added plugin URL handler for %s (%s) as %d' %
|
dbg('added plugin URL handler for %s (%s) as %d' %
|
||||||
(name, urlplugin.__class__.__name__,
|
(name, urlplugin.__class__.__name__,
|
||||||
|
@ -322,7 +325,7 @@ class Terminal(Gtk.VBox):
|
||||||
if name in self.matches:
|
if name in self.matches:
|
||||||
err('Terminal::match_add: Refusing to create duplicate match %s' % name)
|
err('Terminal::match_add: Refusing to create duplicate match %s' % name)
|
||||||
return
|
return
|
||||||
reg = GLib.Regex.new(match, GLib.RegexCompileFlags.OPTIMIZE, 0)
|
reg = GLib.Regex.new(match, self.regex_flags, 0)
|
||||||
self.matches[name] = self.vte.match_add_gregex(reg, 0)
|
self.matches[name] = self.vte.match_add_gregex(reg, 0)
|
||||||
|
|
||||||
def match_remove(self, name):
|
def match_remove(self, name):
|
||||||
|
|
Loading…
Reference in New Issue