diff options
author | Evgeni Chasnovski <evgeni.chasnovski@gmail.com> | 2022-01-29 16:08:44 +0200 |
---|---|---|
committer | GitHub <noreply@github.com> | 2022-01-29 14:08:44 +0000 |
commit | 5e1c487d9915f84c95222f05ceeec66572fb604e (patch) | |
tree | 5feb2c9c0c7270c5f6890d729d504f638a84bb2d /test/functional | |
parent | ed0808412cc5e8b53e4d1d1ad466c4f710a03e66 (diff) | |
download | rneovim-5e1c487d9915f84c95222f05ceeec66572fb604e.tar.gz rneovim-5e1c487d9915f84c95222f05ceeec66572fb604e.tar.bz2 rneovim-5e1c487d9915f84c95222f05ceeec66572fb604e.zip |
vim-patch:8.2.4090: after restoring a session buffer order can be quite different (#17112)
Problem: After restoring a session buffer order can be quite different.
Solution: Create buffers first. (Evgeni Chasnovski, closes vim/vim#9520)
https://github.com/vim/vim/commit/26ebf1f036517ebeacf571c333a83cca7e13bbe2
---------------
As in Vim, this basically reverts 8.1.0829 providing different solution
(see vim/vim#9520).
Regarding Neovim, this basically reverts changes from #15062. Test about
restoring same terminals was a bit too restrictive with using actual
buffer ids, which changed with this patch (now they should be in the
same order as at `mksession` call), so I tweaked it.
Diffstat (limited to 'test/functional')
-rw-r--r-- | test/functional/ex_cmds/mksession_spec.lua | 15 |
1 files changed, 6 insertions, 9 deletions
diff --git a/test/functional/ex_cmds/mksession_spec.lua b/test/functional/ex_cmds/mksession_spec.lua index 09eaa36686..aefcc53cab 100644 --- a/test/functional/ex_cmds/mksession_spec.lua +++ b/test/functional/ex_cmds/mksession_spec.lua @@ -5,6 +5,7 @@ local clear = helpers.clear local command = helpers.command local get_pathsep = helpers.get_pathsep local eq = helpers.eq +local neq = helpers.neq local funcs = helpers.funcs local matches = helpers.matches local pesc = helpers.pesc @@ -30,7 +31,8 @@ describe(':mksession', function() -- If the same :terminal is displayed in multiple windows, :mksession -- should restore it as such. - -- Create two windows showing the same :terminal buffer. + -- Create three windows: first two from top show same terminal, third - + -- another one (created earlier). command('terminal') command('split') command('terminal') @@ -43,8 +45,8 @@ describe(':mksession', function() -- Restore session. command('source '..session_file) - eq({2,2,4}, - {funcs.winbufnr(1), funcs.winbufnr(2), funcs.winbufnr(3)}) + eq(funcs.winbufnr(1), funcs.winbufnr(2)) + neq(funcs.winbufnr(1), funcs.winbufnr(3)) end) it('restores tab-local working directories', function() @@ -91,12 +93,7 @@ describe(':mksession', function() command('tabnext 1') eq(cwd_dir .. get_pathsep() .. tmpfile_base .. '1', funcs.expand('%:p')) command('tabnext 2') - -- :mksession stores paths using unix slashes, but Nvim doesn't adjust these - -- for absolute paths in all cases yet. Absolute paths are used in the - -- session file after :tcd, so we need to expect unix slashes here for now - -- eq(cwd_dir .. get_pathsep() .. tmpfile_base .. '2', funcs.expand('%:p')) - eq(cwd_dir:gsub([[\]], '/') .. '/' .. tmpfile_base .. '2', - funcs.expand('%:p')) + eq(cwd_dir .. get_pathsep() .. tmpfile_base .. '2', funcs.expand('%:p')) end) it('restores CWD for :terminal buffers #11288', function() |