Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

When going from Reader to 'History' + 'View full size cover' and back to Reader #4346

Closed
gerhaher opened this issue Nov 19, 2018 · 4 comments
Labels

Comments

@gerhaher
Copy link

gerhaher commented Nov 19, 2018

  • KOReader version: v2018.11.1-27-gafc4be3_2018-11-16/
  • Device: KA1

Issue

When reading a book and open 'History' and 'View full size cover' and then go back to reading you end up on some previous page of the book and the page counting is messy.

Steps to reproduce

  1. Ensure that you have books in your 'History'-page
  2. Open a new book and page forward several pages. 50 pages should be enough, but 100 pages probably makes the issue more obvious. You can use the +10 feature. Or just use 'Go to location'.
  3. Open 'History' and longpress on a book and open 'View full size cover'.
  4. Close cover window and close 'History'
  5. Now things have happened with the book you read. The 'Current page' and 'Pages left in chapter' figures are the same but the text are from some previous part of the book. Which means that 'Current page' and 'Pages left in chapter' values aren't correct. So for example if you open table of contents and tap on a chapter you end up somewhere in the middle of a chapter.
    If you go to file manager and then reopen the book the page counting returns to correct values, but (if you have page forward or something similar) you are still on the same previous place in the book.
@Frenzie Frenzie added the bug label Nov 19, 2018
@poire-z
Copy link
Contributor

poire-z commented Nov 19, 2018

I can reproduce it.
It happens also when History is in Classic display mode, and you select Book information on a document without a .sdr (so, metadata not cached in the metadata.lua file, and need to open the book to get them).
Actually, just having crengine open a 2nd book (to extract metadata or cover image) causes some problem, like current book cache being invalid on next load).

Cool Reader / original crengine is supposed to be able to open multiple books simultaneously.
We don't have that requirement in KOReader (except indeed, when getting metadata or cover image...), and it's quite possible I took some shortcuts related to that in my last months modifications... Like using global variables... There was already a bool gFlgFloatingPunctuationEnabled, I added gDOMVersionRequested, gRenderDPI, gRenderScaleFontWithDPI, gRootFontSize.
Could be because of that (I hope), and may be I re-set them too early (in which case, I should re-set them later, and the requirement would become that we can load multiple document, but we can only have a single one rendered at a same time, which would be fine enough for KOReader.

@poire-z
Copy link
Contributor

poire-z commented Nov 19, 2018

OK, not cause of my changes :) And I think there's no change needed on crengine side.

There are just a few settings (that ends up being accounted in a GlobalHash) that are (re)set when creating a new CRE document.

I'll move these in a new cre.cpp method readDefaults() (that apply settings from cr3.ini - that could possibly be removed totally and hardcoded in crengine - but may be some people have put some specific crengine settings in it, so let's keep it) that will be called only by ReaderUI when opening a document for display - and not by the other code that just opens a document for next just calling loadDocument(only_metadata)

Also, setting a default fallback font (which ends up in fontMan->GetFontListHash(documentId)) will have to be moved at start of CreDocument:render() so that too will be done only when displaying.

Frenzie pushed a commit that referenced this issue Nov 20, 2018
When a main document is opened for displaying, some other
document openings (for getting metadata or cover image)
could affect the main document.
Split some code from CreDocument:init() into another new
method CreDocument:setupDefaultView(), that will only be
called by ReaderUI when opening the main document (and not
by these other openings like Book inforation, View cover...)

Also speed up some of these other openings (Search, Screensaver)
by using doc:loadDocument(false) to load only metadata and
avoid parsing the HTML.

Details in #4346 (comment)
@poire-z
Copy link
Contributor

poire-z commented Nov 21, 2018

@gerhaher : can you confirm this is fixed in today's nightly v2018.11.1-34-g3c6c15e, in all the various ways you managed to trigger the bug?

@gerhaher
Copy link
Author

Seems OK, I can't trigger it.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

3 participants