mirror of
https://github.com/neovim/neovim.git
synced 2025-12-04 13:42:41 +00:00
fix(terminal): use terminal buffer for TermRequest autocommand (#26974)
This commit is contained in:
@@ -318,16 +318,23 @@ describe(':terminal buffer', function()
|
||||
)
|
||||
end)
|
||||
|
||||
it('emits TermRequest events', function()
|
||||
it('emits TermRequest events #26972', function()
|
||||
command('split')
|
||||
command('enew')
|
||||
local term = meths.open_term(0, {})
|
||||
local termbuf = meths.get_current_buf().id
|
||||
|
||||
-- Test that autocommand buffer is associated with the terminal buffer, not the current buffer
|
||||
command('au TermRequest * let g:termbuf = +expand("<abuf>")')
|
||||
command('wincmd p')
|
||||
|
||||
-- cwd will be inserted in a file URI, which cannot contain backs
|
||||
local cwd = funcs.getcwd():gsub('\\', '/')
|
||||
local parent = cwd:match('^(.+/)')
|
||||
local expected = '\027]7;file://host' .. parent
|
||||
meths.chan_send(term, string.format('%s\027\\', expected))
|
||||
eq(expected, eval('v:termrequest'))
|
||||
eq(termbuf, eval('g:termbuf'))
|
||||
end)
|
||||
end)
|
||||
|
||||
|
||||
Reference in New Issue
Block a user