Code discussion: How to smoothly reload a changed file?
Currently, when a file is changed outside of Zettlr, and Zettlr reloads the file, the view and cursor position are reset to the top. I rather think we can do better and attempt to reset the same view and cursor position before the reload.
I've already implemented the few lines of code in the openFile() and this seems to work nicely for only text. However, inline rendered content that expands (images, LaTeX, etc.) throws off my scroll position restore. For instance, if you put a big header image in your MD, then scroll down your post. The scroll position now includes the height of the image. Then when we reload the file and restore scroll position, the image is not yet rendered, so we actually restore to a scroll position that is further down the file than necessary.
Any thoughts what I can do about this? My naive idea is to, at time of saving scroll position, investigate the size of all rendered content that is above current view, and subtract that from the current scroll position.