aboutsummaryrefslogtreecommitdiff
path: root/test/functional/terminal/buffer_spec.lua
diff options
context:
space:
mode:
authorGregory Anders <8965202+gpanders@users.noreply.github.com>2024-01-09 21:31:37 -0600
committerGitHub <noreply@github.com>2024-01-09 21:31:37 -0600
commitfa17a5ab49dff5a2e4de7bd2faee31f5458993aa (patch)
treebfe1b20b1ade62f6fc82be7c1bcfd9738e1dbc36 /test/functional/terminal/buffer_spec.lua
parent63a17322dd835724887517c1309e70c06748ed59 (diff)
downloadrneovim-fa17a5ab49dff5a2e4de7bd2faee31f5458993aa.tar.gz
rneovim-fa17a5ab49dff5a2e4de7bd2faee31f5458993aa.tar.bz2
rneovim-fa17a5ab49dff5a2e4de7bd2faee31f5458993aa.zip
fix(terminal): use terminal buffer for TermRequest autocommand (#26974)
Diffstat (limited to 'test/functional/terminal/buffer_spec.lua')
-rw-r--r--test/functional/terminal/buffer_spec.lua9
1 files changed, 8 insertions, 1 deletions
diff --git a/test/functional/terminal/buffer_spec.lua b/test/functional/terminal/buffer_spec.lua
index d0462b5619..497d7668e8 100644
--- a/test/functional/terminal/buffer_spec.lua
+++ b/test/functional/terminal/buffer_spec.lua
@@ -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)