mirror of
https://github.com/kovidgoyal/calibre.git
synced 2025-07-08 10:44:09 -04:00
Fix preview position not correct when switching back to a previously opened editor
This commit is contained in:
parent
c6dadb7100
commit
df97799deb
@ -894,7 +894,14 @@ class Boss(QObject):
|
||||
name = n
|
||||
break
|
||||
if name is not None and getattr(ed, 'syntax', None) == 'html':
|
||||
self.gui.preview.show(name)
|
||||
if self.gui.preview.show(name):
|
||||
# The file being displayed by the preview has changed.
|
||||
# Set the preview's position to the current cursor
|
||||
# position in the editor, in case the editors' cursor
|
||||
# position has not changed, since the last time it was
|
||||
# focused. This is not inefficient since multiple requests
|
||||
# to sync are de-bounced with a 100 msec wait.
|
||||
self.sync_preview_to_editor()
|
||||
if name is not None:
|
||||
self.gui.file_list.mark_name_as_current(name)
|
||||
if ed.has_line_numbers:
|
||||
|
@ -528,6 +528,7 @@ class Preview(QWidget):
|
||||
self.current_name = name
|
||||
parse_worker.add_request(name)
|
||||
self.view.setUrl(QUrl.fromLocalFile(current_container().name_to_abspath(name)))
|
||||
return True
|
||||
|
||||
def refresh(self):
|
||||
if self.current_name:
|
||||
|
Loading…
x
Reference in New Issue
Block a user