-
-
Notifications
You must be signed in to change notification settings - Fork 5.4k
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 mksession to set localdir correctly when there are multiple tabs #3152
Closed
Conversation
This file contains 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
Change the generated scripts to first create all the tabs (similar to how window splits work) before populating each tab. This prevents local options (including localdir) from spilling over to other tabs when using ':tabedit'. Also fix mksession not setting "tabonly". It would first clear the current tab by using "only" but leave the other tabs along. This makes tabs more consistent with how window splits are cleared. Fix blank window removed by mksession (due to s:wipebuf) if it's the first window in first tab. See vim#1282. Add tests to test the above cases.
I just saw from that the unit tests are failing on Windows from my change (https://ci.appveyor.com/project/chrisbra/vim/build/5845/job/5iyg6ol949fwddte). It's due to a minor difference in how |
Oh wait you already fixed that in 81e2ac7, nevermind! |
I just saw from that the unit tests are failing on Windows from my
change
(https://ci.appveyor.com/project/chrisbra/vim/build/5845/job/5iyg6ol949fwddte).
It's due to a minor difference in how `lcd` works on Unix systems and
Windows. I'll submit a new PR to make sure it passes on Windows.
Yeah, it's one of the few commands that work differently on MS-Windows,
because the shell command also works differently. Can be unexpected.
…--
hundred-and-one symptoms of being an internet addict:
182. You may not know what is happening in the world, but you know
every bit of net-gossip there is.
/// Bram Moolenaar -- Bram@Moolenaar.net -- http://www.Moolenaar.net \\\
/// sponsor Vim, vote for features -- http://www.Vim.org/sponsor/ \\\
\\\ an exciting new programming language -- http://www.Zimbu.org ///
\\\ help me help AIDS victims -- http://ICCF-Holland.org ///
|
janlazo
added a commit
to janlazo/neovim
that referenced
this pull request
Dec 18, 2020
… used Problem: The generated sessions file does not restore tabs properly if :lcd was used in one of them. Solution: Create the tab pages before setting the directory. (Yee Cheng Chin, closes vim/vim#3152) vim/vim@26d4b89
janlazo
added a commit
to janlazo/neovim
that referenced
this pull request
Dec 19, 2020
… used Problem: The generated sessions file does not restore tabs properly if :lcd was used in one of them. Solution: Create the tab pages before setting the directory. (Yee Cheng Chin, closes vim/vim#3152) vim/vim@26d4b89
janlazo
added a commit
to janlazo/neovim
that referenced
this pull request
Dec 20, 2020
… used Problem: The generated sessions file does not restore tabs properly if :lcd was used in one of them. Solution: Create the tab pages before setting the directory. (Yee Cheng Chin, closes vim/vim#3152) vim/vim@26d4b89
janlazo
added a commit
to janlazo/neovim
that referenced
this pull request
Dec 20, 2020
… used Problem: The generated sessions file does not restore tabs properly if :lcd was used in one of them. Solution: Create the tab pages before setting the directory. (Yee Cheng Chin, closes vim/vim#3152) vim/vim@26d4b89 Neovim always uses Unix paths for buffers, restored by ":mksession". Buffers with tab-local CWD are now restored with Unix paths on Windows.
janlazo
added a commit
to janlazo/neovim
that referenced
this pull request
Dec 20, 2020
… used Problem: The generated sessions file does not restore tabs properly if :lcd was used in one of them. Solution: Create the tab pages before setting the directory. (Yee Cheng Chin, closes vim/vim#3152) vim/vim@26d4b89 Neovim always uses Unix paths for buffers, restored by ":mksession". Buffers with tab-local CWD are now restored with Unix paths on Windows.
janlazo
added a commit
to janlazo/neovim
that referenced
this pull request
Dec 20, 2020
… used Problem: The generated sessions file does not restore tabs properly if :lcd was used in one of them. Solution: Create the tab pages before setting the directory. (Yee Cheng Chin, closes vim/vim#3152) vim/vim@26d4b89 Neovim always uses Unix paths for buffers, restored by ":mksession". Buffers with tab-local CWD are now restored with Unix paths on Windows.
janlazo
added a commit
to janlazo/neovim
that referenced
this pull request
Dec 21, 2020
… used Problem: The generated sessions file does not restore tabs properly if :lcd was used in one of them. Solution: Create the tab pages before setting the directory. (Yee Cheng Chin, closes vim/vim#3152) vim/vim@26d4b89 Neovim always uses Unix paths for buffers, restored by ":mksession". Buffers with tab-local CWD are now restored with Unix paths on Windows.
janlazo
added a commit
to janlazo/neovim
that referenced
this pull request
Dec 21, 2020
… used Problem: The generated sessions file does not restore tabs properly if :lcd was used in one of them. Solution: Create the tab pages before setting the directory. (Yee Cheng Chin, closes vim/vim#3152) vim/vim@26d4b89
janlazo
added a commit
to janlazo/neovim
that referenced
this pull request
Dec 30, 2020
… used Problem: The generated sessions file does not restore tabs properly if :lcd was used in one of them. Solution: Create the tab pages before setting the directory. (Yee Cheng Chin, closes vim/vim#3152) vim/vim@26d4b89
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.
This patch fixes an issue in
mksession
where local directories don't get properly saved out if there are multiple tabs. A simple repro is as follows:Then in another Vim instance:
The assert will fire. The issue is that mksession makes new tabs using
tabedit
after populating the current tab's windows first. The issue istabedit
will propagate local options to the new tab, including the localdir. Instead, the fix is to pre-populate all the tabs first (similar to how the script pre-populates the window splits inses_win_rec()
).In testing this I also found a couple bugs that I fixed:
silent only
to clear all the other windows first. To fix this, addsilent tabonly
to make sure everything is cleared on load. This also makes sure the last command in the script to re-select the active tab viatabnext
will work properly.mksession
will generate a script that deletes that window, sinces:wipebuf
is actually the buffer for the blank window when restoring. Fix this by making sures:wipebuf
is actually not used anywhere before callingbwipe
on it. See Empty first tab lost when using sessions #1282 for an existing issue calling this out.