Auto-scroll back to last typing scroll instead of top/botton of editor

Use case or problem

There’s an unnatural and confusing behavior when scrolling out of view.

When scrolling, leaving the cursor out of view, followed by typing, the screen automatically scrolls back getting cursor into view. However the cursor will be either on the top or botton (depending whether scroll was up or down).

I’m having trouble locating the cursor and I end up writing garbage and sometimes deleting any selected text because of this.

Proposed solution

The problem is I’m expecting the cursor to be in the same position where I left it (when typing!)
so, instead of saving the last-position-in-view or just default to top/botto, the last-scroll-set-position (if moved the cursor) or last-typing-position (which should set the last-scroll-set-position too) or should be saved and restore on scrolling.

Perhaps there are additional cues like highlighting it (I don’t know what other best practices there are).

Related feature requests (optional)

Another good feature that’s missing is “Go to last edit location”, “Go to last view location”, somethign that I often use with IDEs while editing multiple files, letting you trace back your view / edit paths independently.

I cannot reproduce it. My editor works as expected: if you scroll so that cursor position becomes hidden then writing will restore the previous cursor position. Have you tried to reproduce your problem in the sandbox vault?

Edit: I tested in the sandbox and the restoring behavior is inconsistent. Someone has to post a separate bug report about that.