mirror of
https://github.com/neovim/neovim.git
synced 2025-02-25 18:55:25 -06:00
mksession: restore same :term buf in split windows
Problem: When session-restore creates a terminal buffer with command
like `:edit term://.//16450:/bin/bash`, the buffer gets
a different name (depends on PID). Thus the later call to
`bufexists('term://.//16450:/bin/bash)` will return false.
Solution: Force the buffer name with :file. This as least ensures
the same buffer will show in multiple windows correctly, as
expected when saving the session. But it still has problems:
1. the PID in the buffer name is bogus
2. redundant :terminal buffers still hang around
fix #5250
This commit is contained in:
committed by
Justin M. Keyes
parent
88f133c30d
commit
cf67f19ac2
@@ -91,4 +91,23 @@ describe(':mksession', function()
|
||||
matches('^term://'..pesc(expected_cwd)..'//%d+:', funcs.expand('%'))
|
||||
command('qall!')
|
||||
end)
|
||||
|
||||
it('restores multiple windows with same terminal instances', function()
|
||||
-- Create a view with two buffers referencing the same terminal instance
|
||||
command('terminal')
|
||||
command('split')
|
||||
command('mksession ' .. session_file)
|
||||
|
||||
clear()
|
||||
|
||||
command('source ' .. session_file)
|
||||
-- Getting the name of the buffer shown to compare with the other window
|
||||
local eval = helpers.eval
|
||||
|
||||
command('exe 1 . "wincmd w"')
|
||||
local expected_pid = eval('b:terminal_job_pid')
|
||||
|
||||
command('exe 2 . "wincmd w"')
|
||||
eq(expected_pid, eval('b:terminal_job_pid'))
|
||||
end)
|
||||
end)
|
||||
|
||||
Reference in New Issue
Block a user