Skip to content

Commit

Permalink
Fix save cursor position at exit
Browse files Browse the repository at this point in the history
Closes last comment at issue #611
  • Loading branch information
jaap-karssenberg committed Dec 9, 2021
1 parent f27bbd7 commit 69fd0c5
Showing 1 changed file with 4 additions and 4 deletions.
8 changes: 4 additions & 4 deletions zim/gui/mainwindow.py
Original file line number Diff line number Diff line change
Expand Up @@ -628,6 +628,10 @@ def save_uistate(self):
# Not allowed to save before plugins are loaded, could overwrite
# pane state based on empty panes

cursor = self.pageview.get_cursor_pos()
scroll = self.pageview.get_scroll_pos()
self.history.set_state(self.page, cursor, scroll)

if self.is_visible() and not self.isfullscreen:
self.uistate['windowpos'] = tuple(self.get_position())
self.uistate['windowsize'] = tuple(self.get_size())
Expand Down Expand Up @@ -695,10 +699,6 @@ def open_page(self, path, anchor=None):
if self.page.modified:
return False # Assume SavePageErrorDialog was shown and cancelled

old_cursor = self.pageview.get_cursor_pos()
old_scroll = self.pageview.get_scroll_pos()
self.history.set_state(self.page, old_cursor, old_scroll)

self.save_uistate()

logger.info('Open page: %s (%s)', page, path)
Expand Down

0 comments on commit 69fd0c5

Please sign in to comment.