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

Fix #223, where session is loaded into Lazy window #305

Merged
merged 2 commits into from
Jun 21, 2024

Conversation

cameronr
Copy link
Collaborator

Based on @zamotany's code here:
#223 (comment)

If Lazy is present, we wait to automatically restore the session until we get the VeryLazy event and there's no Lazy window still up.

If Lazy isn't present, loading works as before.

Based on @zamotany's code here:
rmagatti#223 (comment)

If Lazy is present, we wait to automatically restore the session until
we get the VeryLazy event and there's no Lazy window still up.

If Lazy isn't present, loading works as before.
@cameronr
Copy link
Collaborator Author

I looked a little more closely at the Lazy events. I'm still testing locally, but I think we could probably use LazyDone instead of VeryLazy. It won't matter when there's an update popup (since dismissing that will take longer than either event) but during normal usage when there is no popup, I think LazyDone would be a bit faster to restore the session.

Changed the code to check for the Lazy window on the VimEnter event
(there's no benefit to waiting for the VeryLazy event and it would slow
down normal loading when Lazy doesn't pop up a window). If the window is
present, we wait until we get a close event for the Lazy window (as
before)

Added a config option: auto_restore_lazy_delay_enabled. It's not
necessary to change as Lazy is autodetected but it might be useful for
debugging or narrowing down issues if someone is having trouble with
autorestore. Setting it to false with Lazy installed will produce the
pre-fix behavior of restoring the session into the Lazy window
@cameronr
Copy link
Collaborator Author

I realized we could use VimEnter so changed the code to that. Also added an option to disable the Lazy delay

Copy link
Owner

@rmagatti rmagatti left a comment

Choose a reason for hiding this comment

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

Very clever way to achieve this. Thanks for tackling this! 🎉

@rmagatti rmagatti merged commit 7d7eeac into rmagatti:main Jun 21, 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.

2 participants