Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Appearance settings

Commit c563133

Browse filesBrowse files
cjlarosejustinmk
authored andcommitted
:mksession : restore tab-local working directories #9754
1 parent 8698830 commit c563133
Copy full SHA for c563133

File tree

2 files changed

+24
-0
lines changed
Filter options

2 files changed

+24
-0
lines changed

‎src/nvim/ex_docmd.c

Copy file name to clipboardExpand all lines: src/nvim/ex_docmd.c
+1Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -9130,6 +9130,7 @@ makeopens(
91309130
|| put_eol(fd) == FAIL) {
91319131
return FAIL;
91329132
}
9133+
did_lcd = true;
91339134
}
91349135

91359136
/* Don't continue in another tab page when doing only the current one

‎test/functional/ex_cmds/mksession_spec.lua

Copy file name to clipboardExpand all lines: test/functional/ex_cmds/mksession_spec.lua
+23Lines changed: 23 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -47,4 +47,27 @@ describe(':mksession', function()
4747
command('tabnext 2')
4848
eq(cwd_dir .. get_pathsep() .. tab_dir, funcs.getcwd())
4949
end)
50+
51+
it('restores buffers when using tab-local working directories', function()
52+
local tmpfile_base = file_prefix .. '-tmpfile'
53+
local cwd_dir = funcs.getcwd()
54+
local session_path = cwd_dir .. get_pathsep() .. session_file
55+
56+
command('edit ' .. tmpfile_base .. '1')
57+
command('tcd ' .. tab_dir)
58+
command('tabnew')
59+
command('edit ' .. cwd_dir .. get_pathsep() .. tmpfile_base .. '2')
60+
command('tabfirst')
61+
command('mksession ' .. session_path)
62+
63+
-- Create a new test instance of Nvim.
64+
clear()
65+
66+
-- Use :silent to avoid press-enter prompt due to long path
67+
command('silent source ' .. session_path)
68+
command('tabnext 1')
69+
eq(cwd_dir .. get_pathsep() .. tmpfile_base .. '1', funcs.expand('%:p'))
70+
command('tabnext 2')
71+
eq(cwd_dir .. get_pathsep() .. tmpfile_base .. '2', funcs.expand('%:p'))
72+
end)
5073
end)

0 commit comments

Comments
0 (0)
Morty Proxy This is a proxified and sanitized view of the page, visit original site.