Repository navigation
fix(persist): Keep saved sessions intact across quick peeks, directories and instances - #56
Merged
Merged
Conversation
Quick peek popups emit PeekstackPush and PeekstackClose like stacked popups, so auto save treated them as a change to the stack of the window they opened in and overwrote the auto session with it, usually empty. Events flagged as ephemeral are now ignored by auto save.
With auto.save = false the change events were not observed at all, so save_on_leave never learned which stack to write and silently did nothing. Stack changes are now tracked whenever either option is on, and only the debounced write depends on auto.save.
Sessions dropped buffer_mode when it was "copy", so a restore applied the global ui.popup.buffer_mode instead and brought a copy back as the real file buffer whenever the default was "source". The mode is now saved for every popup.
Session commands resolved the store again once a prompt, picker or delete confirmation answered, so changing directory while it was open deleted, restored or saved the session of another repository. The store and target window are now fixed when the command runs and passed through every later step, and the persist API accepts an explicit store_path.
The update queue only serialized writes within one process, so two instances saving different sessions at once could both read the same store and the later write dropped the other's session. Each update now holds an exclusive <store>.lock from before the read until after the write, waits up to a second for another holder, and takes over a lock left stale by an instance that exited.
On a loaded runner an auto save could outlast the 500ms wait and then land after cleanup, leaking into the next test's store. Each real-store auto save test now uses its own store, and the async waits in the new session command and lock tests allow more time.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
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.
Summary
save_on_leaveworks on its own when debouncedauto.saveis offui.popup.buffer_modeChanges
PeekstackPush/PeekstackCloseevents flagged as ephemeral, so a quick peek in an empty window no longer replaces the saved stacksaveorsave_on_leaveis enabled; only the debounced write depends onsavebuffer_modeis saved for every popup, including"copy", so a restore under a"source"default no longer reopens the real file bufferrestore,list_sessions,delete_sessionandrename_sessionaccept an explicitstore_path<store>.lockand fails with a warning if another instance keeps it for more than a second