ReaderSearch: delay adding to location stack until we change page

Search may highlight matches on the current page, and if there
are no others in the book, we would stay there and resume reading;
but we would get a spurious previous location (ie. in Book map)
that we would not expect keeping, and we may accidently go back
to previous location, losing our reading position.
Avoid this by only adding current page to location stack when
actually leaving the current page.
Because of complications with other reading modes, this is
currently only enabled for CRE document when in page mode.
This commit is contained in:
poire-z
2024-05-05 20:59:18 +02:00
parent 03d16270d9
commit 001e90db1e
2 changed files with 25 additions and 2 deletions

View File

@@ -712,6 +712,10 @@ function ReaderLink:addCurrentLocationToStack(loc)
table.insert(self.location_stack, location)
end
function ReaderLink:popFromLocationStack()
return table.remove(self.location_stack)
end
function ReaderLink:onClearLocationStack(show_notification)
self.location_stack = {}
self:onClearForwardLocationStack()