diff options
author | Chris LaRose <cjlarose@gmail.com> | 2019-03-21 03:53:38 -0700 |
---|---|---|
committer | Justin M. Keyes <justinkz@gmail.com> | 2019-03-21 11:53:38 +0100 |
commit | c5631338b16b2a21e0abbbc54494f660f6e7fb76 (patch) | |
tree | 52266c7e109360f0894e1e4460ef92b7b9bfeb7c | |
parent | 8698830cbd73f48125768632ac7f0f0b95c1a58b (diff) | |
download | rneovim-c5631338b16b2a21e0abbbc54494f660f6e7fb76.tar.gz rneovim-c5631338b16b2a21e0abbbc54494f660f6e7fb76.tar.bz2 rneovim-c5631338b16b2a21e0abbbc54494f660f6e7fb76.zip |
:mksession : restore tab-local working directories #9754
-rw-r--r-- | src/nvim/ex_docmd.c | 1 | ||||
-rw-r--r-- | test/functional/ex_cmds/mksession_spec.lua | 23 |
2 files changed, 24 insertions, 0 deletions
diff --git a/src/nvim/ex_docmd.c b/src/nvim/ex_docmd.c index 3467bc8b92..0ea383dbb6 100644 --- a/src/nvim/ex_docmd.c +++ b/src/nvim/ex_docmd.c @@ -9130,6 +9130,7 @@ makeopens( || put_eol(fd) == FAIL) { return FAIL; } + did_lcd = true; } /* Don't continue in another tab page when doing only the current one diff --git a/test/functional/ex_cmds/mksession_spec.lua b/test/functional/ex_cmds/mksession_spec.lua index a5b327095e..0f7860740e 100644 --- a/test/functional/ex_cmds/mksession_spec.lua +++ b/test/functional/ex_cmds/mksession_spec.lua @@ -47,4 +47,27 @@ describe(':mksession', function() command('tabnext 2') eq(cwd_dir .. get_pathsep() .. tab_dir, funcs.getcwd()) end) + + it('restores buffers when using tab-local working directories', function() + local tmpfile_base = file_prefix .. '-tmpfile' + local cwd_dir = funcs.getcwd() + local session_path = cwd_dir .. get_pathsep() .. session_file + + command('edit ' .. tmpfile_base .. '1') + command('tcd ' .. tab_dir) + command('tabnew') + command('edit ' .. cwd_dir .. get_pathsep() .. tmpfile_base .. '2') + command('tabfirst') + command('mksession ' .. session_path) + + -- Create a new test instance of Nvim. + clear() + + -- Use :silent to avoid press-enter prompt due to long path + command('silent source ' .. session_path) + command('tabnext 1') + eq(cwd_dir .. get_pathsep() .. tmpfile_base .. '1', funcs.expand('%:p')) + command('tabnext 2') + eq(cwd_dir .. get_pathsep() .. tmpfile_base .. '2', funcs.expand('%:p')) + end) end) |