mirror of
				https://github.com/neovim/neovim.git
				synced 2025-11-04 09:44:31 +00:00 
			
		
		
		
	:mksession : restore tab-local working directories #9754
This commit is contained in:
		
				
					committed by
					
						
						Justin M. Keyes
					
				
			
			
				
	
			
			
			
						parent
						
							8698830cbd
						
					
				
				
					commit
					c5631338b1
				
			@@ -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
 | 
			
		||||
 
 | 
			
		||||
@@ -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)
 | 
			
		||||
 
 | 
			
		||||
		Reference in New Issue
	
	Block a user