mirror of
git://github.com/kovidgoyal/calibre.git
synced 2026-05-09 11:14:02 +02:00
Should be passing barenames to goto_sourceline
This commit is contained in:
parent
fd5ea1552e
commit
804e3fbf1c
1 changed files with 6 additions and 2 deletions
|
|
@ -1414,16 +1414,20 @@ def show_partial_cfi_in_editor(self, name, cfi):
|
|||
editor.get_raw_data(), decoder=lambda x: x.decode('utf-8'),
|
||||
line_numbers=True, linenumber_attribute='data-lnum')
|
||||
node = decode_cfi(root, cfi)
|
||||
|
||||
def barename(x):
|
||||
return x.tag.partition('}')[-1]
|
||||
|
||||
if node is not None:
|
||||
lnum = node.get('data-lnum')
|
||||
if lnum:
|
||||
tags_before = []
|
||||
for tag in root.xpath('//*[data-lnum="%s"]' % lnum):
|
||||
tags_before.append(tag)
|
||||
tags_before.append(barename(tag))
|
||||
if tag is node:
|
||||
break
|
||||
else:
|
||||
tags_before.append(node)
|
||||
tags_before.append(barename(node))
|
||||
lnum = int(lnum)
|
||||
return editor.goto_sourceline(lnum, tags_before, attribute='id' if node.get('id') else None)
|
||||
return False
|
||||
|
|
|
|||
Loading…
Reference in a new issue