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

Feature/remember scroll position #115

Merged
merged 3 commits into from
Apr 22, 2024

Conversation

murilopolese
Copy link
Contributor

Problem

When switching between tabs the scroll position is lost.

Solution

We need to make sure when an editor is rendered, it scrolls back to where it was.
The state.openFiles objects have the instance of choo's component under the editor property.
Each choo component stores their own state independently of the main application state, so it makes sense to store the scroll position there instead of the main state.

Not cool

I think there is an edge case with large files that they take some time to fully load and that messes

The scroll listener and scrollTo are made in a timeout callback because I can't find out how to get a ready event from CodeMirror. 🤷

Extra

I noticed that the tab wasn't being selected when you click on the device icon (cables or computer) so I wrote a little fix for that too.

@murilopolese murilopolese requested a review from ubidefeo April 18, 2024 13:10
Copy link
Collaborator

@ubidefeo ubidefeo left a comment

Choose a reason for hiding this comment

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

tested and approved

@murilopolese murilopolese merged commit 2e45b71 into development Apr 22, 2024
1 check passed
@murilopolese murilopolese deleted the feature/remember-scroll-position branch April 22, 2024 07:06
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.

2 participants