From f0cc46958cc38917078e7df7863e592a799b51e7 Mon Sep 17 00:00:00 2001 From: Kovid Goyal Date: Sat, 19 Jan 2019 11:52:34 +0530 Subject: [PATCH] Fix #1812400 [Cursor missplace on show_partial_cfi_in_editor() function](https://bugs.launchpad.net/calibre/+bug/1812400) --- src/calibre/gui2/tweak_book/boss.py | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/src/calibre/gui2/tweak_book/boss.py b/src/calibre/gui2/tweak_book/boss.py index f1f4e27054..436da352ab 100644 --- a/src/calibre/gui2/tweak_book/boss.py +++ b/src/calibre/gui2/tweak_book/boss.py @@ -1417,8 +1417,13 @@ class Boss(QObject): 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) + if tag is node: + break lnum = int(lnum) - editor.current_line = lnum + editor.goto_sourceline(lnum, tags_before, attribute='id' if node.get('id') else None) return True return False