Restore “first visible character” instead of visible rectangle

This is when switching tabs ore re-opening a file.

Restoring the visible rectangle doesn’t always work because we do an initial heuristic layout where we don’t do proper soft wrap and may also lack scoped settings to increase font size for headings, meaning that the restored visible rectangle does not point to the same section of the text, as it would with a fully updated layout.

This fixes #243.
Update document dimensions before restoring scroll position

Since the document starts out the same width as the view port, horizontal scroll position was effectively never restored, fixes #605.