fix: fallback to last buffer if window empty (#66)#74
Merged
stevearc merged 1 commit intostevearc:masterfrom Jun 1, 2025
jpetrie:master
Merged
fix: fallback to last buffer if window empty (#66)#74stevearc merged 1 commit intostevearc:masterfrom jpetrie:master
stevearc merged 1 commit intostevearc:masterfrom
jpetrie:master
Conversation
Owner
|
Agree that this is better default behavior. Thanks for the PR! |
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.
If
curwinisnilduring session load (which can happen when the buffer in the only window was filtered out of the session), fall back to opening the last restored buffer.Currently, as described by #66, if the last buffer in the last window is something you're filtering out (by default or with a custom
buf_filter, when you restore that session you get an empty window. With this change, you'll instead get the most-recently-restored buffer from the session.This should only affect single-window, single-tab scenarios (the existing behavior in those scenarios, where the window containing the filtered-out buffer is simply not restored) should be preserved by this change.
This isn't gated by an option because the current behavior felt like a bug to me, but it would be pretty easy to add a
fall_back_to_most_recentoption (maybe with a better name) if desired.