izuzak / atom-pdf-view

Support for viewing PDF files in Atom.
https://atom.io/packages/pdf-view
MIT License
106 stars 30 forks source link

Scroll position sometimes resets on update #117

Closed 314eter closed 8 years ago

314eter commented 8 years ago

If the pdf file is changed by an external tool (e.g. latex), the file is empty (which triggers an update) before it gets filled with data. If the external tool is too slow, pdf.js throws an error because the file is still empty. There is nothing to show, and the scroll position resets to 0. On the next update (when the pdf is ready), the scroll position is 0.

izuzak commented 8 years ago

Hey @314eter, thanks for opening an issue. I'm not sure I understand what's going on here. You said an error is thrown but you didn't provide one -- what error is thrown exactly? Are you able to reproduce the error manually, without using an external tool? You said that this happens when the file is empty -- that makes me think this should be possible to reproduce by replacing the file with an empty pdf file, right? Are you able to reliably reproduce this without using an external tool so that I can try and reproduce it as well?

314eter commented 8 years ago

Steps to reproduce:

  1. Make a copy of a pdf file (we'll call them original.pdf and copy.pdf)
  2. Open copy.pdf in atom, and scroll down.
  3. Then simulate an external tool that (slowly) rebuilds the pdf
    1. dd if=original.pdf of=copy.pdf bs=1k count=0
    2. dd if=original.pdf of=copy.pdf bs=1k count=10
    3. ...

The pdf-view in atom is empty during step 3. When copy.pdf is completely rebuild, it reappears, but the position and zoom-level is reset.

Building a pdf with e.g. latex can take some time. It's annoying that you can't see the pdf during the build, and that the position is lost when it's back.