What happened:
When a Snapshot Event occurs in CodeMirror, it overwrites the content within the editor with Snapshot data and moves the cursor based on Presence. However, several issues are observed:
While dragging with the mouse, if a Snapshot Event occurs, the starting point of the drag moves to the topmost position.
If a Snapshot Event occurs during text input, there are intermittent instances where the scroll jumps to the top and then returns to the current position.
It seems that this issue is related to the moment the code is executed, because when dragging is done via keyboard, the problem does not occur. The following code snippet appears to be the culprit:
What you expected to happen:
The cursor should remain at the correct position during and after the Snapshot Event, without any scroll jumps or unexpected behavior.
How to reproduce it (as minimally and precisely as possible):
Start dragging content in CodeMirror.
Trigger a Snapshot Event during the drag action. (We can trigger snapshot event adjusting snapshot-threshold)
What happened: When a Snapshot Event occurs in CodeMirror, it overwrites the content within the editor with Snapshot data and moves the cursor based on Presence. However, several issues are observed:
https://github.com/user-attachments/assets/6145858b-e3ce-41b2-a9df-aa66e1d57327
It seems that this issue is related to the moment the code is executed, because when dragging is done via keyboard, the problem does not occur. The following code snippet appears to be the culprit:
What you expected to happen: The cursor should remain at the correct position during and after the Snapshot Event, without any scroll jumps or unexpected behavior.
How to reproduce it (as minimally and precisely as possible):
snapshot-threshold
)Anything else we need to know?:
Environment: