XCode Assistant Editor scroll and cursor position broken, does not stay fixed, moves on its own.

Hi there,

This issue was first observed in XCode 12, and has persisted until today's update to XCode 13. I will be very precise in explaining its behaviour as if I were on the other side of this report, having to fix this.

Scenario: Let there be two scroll positions ScrollA and ScrollB, and two cursor positions CursorA and CursorB, which are all within the Assistant Editor for some document tab DocTabA (i.e. document tabs are the new tabs that were introduced in XCode 12). Let the Assistant Editor's beginning view state be displaying at ScrollA with the cursor at CursorA, in the DocTabA. Then, let's say I move within the Assistant Editor, either by mouse click or keyboard shortcut, to some different cursor pos CursorB which may or may not have been preceded by a scroll movement to ScrollB (i.e. ScrollA may be equal to ScrollB).

Issue: When the cursor position is moved in the Primary Editor (either by mouse click or keyboard shortcut) the Assistant Editor resets back to CursorA and ScrollA. This occurs all while remaining unfocused, after some random time in the range of immediate to 3 seconds.

Expected: When the cursor position is moved in the Primary Editor, the Assistant Editor should remain fixed at CursorB and ScrollB.

Observation 1: It does not matter if the CursorA is contained within the viewport of the scroll position. I.e. after the issue occurs, if the Assistant Editor is focused via keyboard shortcut, the CursorA may be found to be offscreen.

Observation 2: If the CursorA was never moved to CursorB, but the ScrollA was moved to ScrollB, the issue does not occur, i.e. ScrollB remains fixed when the Primary Editor's cursor is moved.

Observation 3: The issue does not occur if the Primary Editor's cursor does not change, i.e. if the Primary Editor is only scrolled, or if it is only focused by keyboard shortcut, or if the mouse clicks on its current cursor position without changing it. The issue only occurs if the cursor position in the Primary Editor is changed, by mouse click or keyboard shortcut (e.g. arrow keys or vim navigation)

Observation 4: To workaround the issue, two things must be done, one after the other, in order for CursorB and ScrollB to remain fixed at their positions. 1) an edit must be made at CursorB, then 2) Another document tab DocTabB must be selected/focused on. When returning back to DocTabA, CursorB and ScrollB persists as if CursorA and ScrollA has been forgotten and the issue has been solved. However, the issue recurs again where CursorB and ScrollB now behave as CursorA and ScrollA in a new issue instance.

Observation 4b: For clarification, the workaround in Observation 4 doesn't work if those things aren't done in that order. That is, if only an edit is made at CursorB, the issue still occurs. And/Or if only a different document tab is selected, the issue still occurs on return back to DocTabA. I must do them both in that order.

Concluding remarks: As you might understand, this has to be the most frustrating experience I've ever encountered in any UI interaction in any app. To justifiably beat a dead horse: every time I want to update the cursor position in the Assistant Editor editor, I have to remember to to make an edit, delete that edit, move to another tab, and then move back to the desired tab. This issue is so irritating that I mapped it to a macro which lead to me remembering to write this post only because I have to update that macro for compatibility with XCode 13's VIM mode. Really what I'm hoping for is that I'm incredibly daft and this is simply fixed by some XCode setting which I can't seem to find. Anyone have any ideas ? Otherwise this is a request for a bug fix. Many thanks for your time.

Same issue here. Still happens in Xcode 14 beta 6

It's still doing this in Xcode 15.3 also. Is there a fix?

XCode Assistant Editor scroll and cursor position broken, does not stay fixed, moves on its own.
 
 
Q