Open internal URLs in commentlinks
If a URL is found in commentlink-processed text (eg, commit or review messages), open it internally if it is an internal link, otherwise, use the web browser. Change-Id: I91f226ab600ad334df8144c23a2e7b232781e24c
This commit is contained in:
parent
a4133c2560
commit
cef92ab99d
@ -50,9 +50,15 @@ class LinkReplacement(object):
|
|||||||
def replace(self, app, data):
|
def replace(self, app, data):
|
||||||
link = mywid.Link(self.text.format(**data), 'link', 'focused-link')
|
link = mywid.Link(self.text.format(**data), 'link', 'focused-link')
|
||||||
urwid.connect_signal(link, 'selected',
|
urwid.connect_signal(link, 'selected',
|
||||||
lambda link:app.openURL(self.url.format(**data)))
|
lambda link:self.activate(app, self.url.format(**data)))
|
||||||
return link
|
return link
|
||||||
|
|
||||||
|
def activate(self, app, url):
|
||||||
|
result = app.parseInternalURL(url)
|
||||||
|
if result is not None:
|
||||||
|
return app.openInternalURL(result)
|
||||||
|
return app.openURL(url)
|
||||||
|
|
||||||
class SearchReplacement(object):
|
class SearchReplacement(object):
|
||||||
def __init__(self, config):
|
def __init__(self, config):
|
||||||
self.query = config['query']
|
self.query = config['query']
|
||||||
|
Loading…
Reference in New Issue
Block a user