Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Implement splitting vertically with syncing #10934

Draft
wants to merge 4 commits into
base: master
Choose a base branch
from

Conversation

Lyndon-Mackay
Copy link

@Lyndon-Mackay Lyndon-Mackay commented Jun 12, 2024

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:

  1. From a usability perspective, should I synchronize scrolling on searches?
  2. How can I best initialize the new view to be a page down, as it will only start synchronizing on the first user scroll, which I find jarring?

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.

@Lyndon-Mackay Lyndon-Mackay reopened this Jun 12, 2024
@Lyndon-Mackay Lyndon-Mackay marked this pull request as draft June 12, 2024 06:08
@Lyndon-Mackay
Copy link
Author

Sorry about closure, thought I had to redo to convert to draft

@Lyndon-Mackay Lyndon-Mackay marked this pull request as ready for review June 12, 2024 07:19
@Lyndon-Mackay Lyndon-Mackay marked this pull request as draft June 12, 2024 07:25
@Lyndon-Mackay
Copy link
Author

Lyndon-Mackay commented Jun 12, 2024

I had another look for question two.
I think in editor.rs I can call my new moved_sync function if I change the signature to use editor rather then context.
but I am not sure how to call commands::moved_sync
I will rename moved_sync as well open to suggetions

Copy link
Member

@the-mikedavis the-mikedavis left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This adds a medium/large amount of code and complexity for something that's mostly cosmetic. I would prefer that something like this live as a plugin

@Lyndon-Mackay
Copy link
Author

Ok I understand the plugin argument

I decided to make the extended split start a page down for my own sake.

@kirawi kirawi added R-wontfix Not planned: Won't fix and removed R-wontfix Not planned: Won't fix labels Jun 15, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

3 participants