Implement splitting vertically with syncing #10934
Draft
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Implementing Sync VSplit Views (#7031)
Overview
The current implementation of the split view works as follows:
When a scroll event occurs, the editor's tree calls a function that synchronizes the views by scrolling the other panes to match the current view. This ensures that the left and right panes remain in sync, with the right view being a page down from the left view.
Limitations and Future Directions
Currently, I have limited the number of synced views to 2 per document, as unfocused views react to the focused views' scrolling actions. This is a simple implementation to get started with.
At this stage, the command cannot be used with different documents, but it could be changed in the future to support side-by-side scrolling of different files.
I have two questions regarding this implementation:
I also noticed that I left some logging code inside, which I need to remove.
Any other feedback would be appreciated.
I especially would love to know a better way to write swap_sync_views implementation is entirely decided by what the borrow checker wants.