I'm writing an editor whose settings (zoom level and first visible position) are restored when its document is changed. I restore the first visible position as follow:
view.FirstVisiblePosition = _firstVisiblePosition;
However, in some cases, the first visible position is set a few lines before the desired line when switching from a document without zoom to one with zoom. After some debugging, it's found to be due to view.VisibleViewLines.FullyVisibleCount. This count is still the count from the previous document. Therefore, the editor thought that it's called to scroll to a position beyond its limit, and, in the end it, only scroll to a "maximum line" possible which is not true.
Thanks and Regards,
[Modified 4 years ago]