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:
James E. Blair 2015-04-07 10:01:46 -07:00
parent a4133c2560
commit cef92ab99d
1 changed files with 7 additions and 1 deletions

View File

@ -50,9 +50,15 @@ class LinkReplacement(object):
def replace(self, app, data):
link = mywid.Link(self.text.format(**data), 'link', 'focused-link')
urwid.connect_signal(link, 'selected',
lambda link:app.openURL(self.url.format(**data)))
lambda link:self.activate(app, self.url.format(**data)))
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):
def __init__(self, config):
self.query = config['query']