feat(terminal): trigger TermRequest autocommand events (#22159)

This commit implements a new TermRequest autocommand event and has Neovim
emit this event when children of terminal buffers emit an OSC or DCS sequence
libvterm does not handle.

The TermRequest autocommand event has additional data in the
v:termrequest variable.

Co-authored-by: Gregory Anders <greg@gpanders.com>
This commit is contained in:
Ghjuvan Lacambre
2024-01-09 15:27:56 +01:00
committed by GitHub
parent f40df63bdc
commit beca827212
11 changed files with 156 additions and 4 deletions

View File

@@ -317,6 +317,18 @@ describe(':terminal buffer', function()
pcall_err(command, 'write test/functional/fixtures/tty-test.c')
)
end)
it('emits TermRequest events', function()
command('split')
command('enew')
local term = meths.open_term(0, {})
-- 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'))
end)
end)
describe('No heap-buffer-overflow when using', function()