add support for OSC-8
This commit is contained in:
parent
0cbdbd89a2
commit
8d783364e6
|
@ -135,6 +135,7 @@ class Terminal(Gtk.VBox):
|
||||||
self.pending_on_vte_size_allocate = False
|
self.pending_on_vte_size_allocate = False
|
||||||
|
|
||||||
self.vte = Vte.Terminal()
|
self.vte = Vte.Terminal()
|
||||||
|
self.vte.set_allow_hyperlink(True)
|
||||||
self.vte._draw_data = None
|
self.vte._draw_data = None
|
||||||
if not hasattr(self.vte, "set_opacity") or \
|
if not hasattr(self.vte, "set_opacity") or \
|
||||||
not hasattr(self.vte, "is_composited"):
|
not hasattr(self.vte, "is_composited"):
|
||||||
|
@ -143,6 +144,7 @@ class Terminal(Gtk.VBox):
|
||||||
self.composite_support = True
|
self.composite_support = True
|
||||||
dbg('composite_support: %s' % self.composite_support)
|
dbg('composite_support: %s' % self.composite_support)
|
||||||
|
|
||||||
|
|
||||||
self.vte.show()
|
self.vte.show()
|
||||||
|
|
||||||
self.default_encoding = self.vte.get_encoding()
|
self.default_encoding = self.vte.get_encoding()
|
||||||
|
@ -955,12 +957,20 @@ class Terminal(Gtk.VBox):
|
||||||
middle_click = [self.paste_clipboard, (True, )]
|
middle_click = [self.paste_clipboard, (True, )]
|
||||||
right_click = [self.popup_menu, (widget, event)]
|
right_click = [self.popup_menu, (widget, event)]
|
||||||
|
|
||||||
|
### Ctrl-click event here.
|
||||||
if event.button == self.MOUSEBUTTON_LEFT:
|
if event.button == self.MOUSEBUTTON_LEFT:
|
||||||
# Ctrl+leftclick on a URL should open it
|
# Ctrl+leftclick on a URL should open it
|
||||||
if event.get_state() & Gdk.ModifierType.CONTROL_MASK == Gdk.ModifierType.CONTROL_MASK:
|
if event.get_state() & Gdk.ModifierType.CONTROL_MASK == Gdk.ModifierType.CONTROL_MASK:
|
||||||
url = self.vte.match_check_event(event)
|
## Check new OSC-8 method first
|
||||||
if url[0]:
|
url = self.vte.hyperlink_check_event(event)
|
||||||
self.open_url(url, prepare=True)
|
dbg('url: %s' % url)
|
||||||
|
if url:
|
||||||
|
self.open_url(url, prepare=False)
|
||||||
|
else:
|
||||||
|
dbg('OSC-8 URL not detected dropping back to regex match')
|
||||||
|
url = self.vte.match_check_event(event)
|
||||||
|
if url[0]:
|
||||||
|
self.open_url(url, prepare=True)
|
||||||
elif event.button == self.MOUSEBUTTON_MIDDLE:
|
elif event.button == self.MOUSEBUTTON_MIDDLE:
|
||||||
# middleclick should paste the clipboard
|
# middleclick should paste the clipboard
|
||||||
# try to pass it to vte widget first though
|
# try to pass it to vte widget first though
|
||||||
|
|
Loading…
Reference in New Issue