I’ll put in another vote on this issue as I’ve seen it occasionally as well, when I am traversing my undo path to get a handle on what modifications I was making on a view when I come back to it after a while. Usually git is able to help me out if I’ve committed recently enough but it’s incredibly disorienting when the cursor is nowhere to be seen and you’re left guessing and confused.
I haven’t found myself in this situation enough (as I think it is a subconcious impulse to attempt not to repeat the actions that lead up to this sort of confusing and negative experience) but my guess is that a quick workaround may be to use the arrow keys after being in this state to identify and focus the cursor again, and that should also not affect the undo buffer state either.
It does not look like the undo function is exposed anywhere for us (it is not a Default package script). There is a chance that we can build a plugin which will define a command that calls undo and then scrolls the cursor or selection back into view. Then we can bind Super+Z/Super+Shift+Z to that instead. For some reason the scrolling being restored is incorrect and we can force it back to the position of the selection because that’s what we really care about anyway, to have it scroll to wherever the cursor is (which should be following the changes).
Update: I think that this will totally not work either, because on the redo it tends to restore and scroll to the incorrect cursor location while the change itself is applied where it originally is (but we no longer know where the hell that is at this point). Very frustrating and I know of no hacky plugin way to achieve this short of somehow pulling out the actual change in the buffer and forcing our cursor over to that, overriding the redo functionality which is placing the cursor in the location that we had navigated to at that point in the history.