Fix highlighting of anchor only links

This commit is contained in:
Kovid Goyal 2014-07-10 21:15:14 +05:30
parent ce72dcb64b
commit 82c33f585c
2 changed files with 6 additions and 1 deletions

View File

@ -114,6 +114,8 @@ def verify_link(url, name=None):
target = _current_container.href_to_name(url, name)
if _current_container.has_name(target):
return True
if url.startswith('#'):
return True
if url.partition(':')[0] in {'http', 'https', 'mailto'}:
return True
return False

View File

@ -798,7 +798,10 @@ class Boss(QObject):
def editor_link_clicked(self, url):
ed = self.gui.central.current_editor
name = editor_name(ed)
target = current_container().href_to_name(url, name)
if url.startswith('#'):
target = name
else:
target = current_container().href_to_name(url, name)
frag = url.partition('#')[-1]
if current_container().has_name(target):
self.link_clicked(target, frag)