Fix Ctrl-click on URL if terminal has padding
This commit is contained in:
parent
14fb184df8
commit
b85796d64b
|
@ -920,7 +920,7 @@ class Terminal(Gtk.VBox):
|
||||||
if event.button == 1:
|
if event.button == 1:
|
||||||
# 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.check_for_url(event)
|
url = self.vte.match_check_event(event)
|
||||||
if url[0]:
|
if url[0]:
|
||||||
self.open_url(url, prepare=True)
|
self.open_url(url, prepare=True)
|
||||||
elif event.button == 2:
|
elif event.button == 2:
|
||||||
|
@ -1418,11 +1418,6 @@ class Terminal(Gtk.VBox):
|
||||||
self.vte.feed(_('Unable to start shell:') + shell)
|
self.vte.feed(_('Unable to start shell:') + shell)
|
||||||
return(-1)
|
return(-1)
|
||||||
|
|
||||||
def check_for_url(self, event):
|
|
||||||
"""Check if the mouse is over a URL"""
|
|
||||||
return (self.vte.match_check(int(event.x / self.vte.get_char_width()),
|
|
||||||
int(event.y / self.vte.get_char_height())))
|
|
||||||
|
|
||||||
def prepare_url(self, urlmatch):
|
def prepare_url(self, urlmatch):
|
||||||
"""Prepare a URL from a VTE match"""
|
"""Prepare a URL from a VTE match"""
|
||||||
url = urlmatch[0]
|
url = urlmatch[0]
|
||||||
|
|
|
@ -40,7 +40,7 @@ class TerminalPopupMenu(object):
|
||||||
self.config.set_profile(terminal.get_profile())
|
self.config.set_profile(terminal.get_profile())
|
||||||
|
|
||||||
if event:
|
if event:
|
||||||
url = terminal.check_for_url(event)
|
url = terminal.vte.match_check_event(event)
|
||||||
button = event.button
|
button = event.button
|
||||||
time = event.time
|
time = event.time
|
||||||
else:
|
else:
|
||||||
|
|
Loading…
Reference in New Issue