diff options
author | zeertzjq <zeertzjq@outlook.com> | 2025-03-08 07:29:45 +0800 |
---|---|---|
committer | GitHub <noreply@github.com> | 2025-03-08 07:29:45 +0800 |
commit | f05a6666cfcb2cd95d860620748cb0fa58b23aba (patch) | |
tree | 5b573893d2596e2664290d914c56a31bf9932b60 /test/functional/terminal/buffer_spec.lua | |
parent | 4a0e0e345340d715f784f317e99abfa71ecbc744 (diff) | |
download | rneovim-f05a6666cfcb2cd95d860620748cb0fa58b23aba.tar.gz rneovim-f05a6666cfcb2cd95d860620748cb0fa58b23aba.tar.bz2 rneovim-f05a6666cfcb2cd95d860620748cb0fa58b23aba.zip |
fix(events): always allow some events to be nested (#32706)
Always allow the following four events to be nested, as they may contain
important information, and are triggered on the event loop, which may be
processed by a blocking call inside another autocommand.
- ChanInfo
- ChanOpen
- TermRequest
- TermResponse
There are some other events that are triggered on the event loop, but
they are mostly triggered by user actions in a UI client, and therefore
not very likely to happen during another autocommand, so leave them
unchanged for now.
Diffstat (limited to 'test/functional/terminal/buffer_spec.lua')
-rw-r--r-- | test/functional/terminal/buffer_spec.lua | 28 |
1 files changed, 28 insertions, 0 deletions
diff --git a/test/functional/terminal/buffer_spec.lua b/test/functional/terminal/buffer_spec.lua index 4fd348af41..599adc87e1 100644 --- a/test/functional/terminal/buffer_spec.lua +++ b/test/functional/terminal/buffer_spec.lua @@ -390,6 +390,34 @@ describe(':terminal buffer', function() }, exec_lua('return _G.input')) end) + it('works with vim.wait() from another autocommand #32706', function() + command('autocmd! nvim.terminal TermRequest') + exec_lua([[ + local term = vim.api.nvim_open_term(0, {}) + vim.api.nvim_create_autocmd('TermRequest', { + buffer = 0, + callback = function(ev) + _G.sequence = ev.data.sequence + _G.v_termrequest = vim.v.termrequest + end, + }) + vim.api.nvim_create_autocmd('TermEnter', { + buffer = 0, + callback = function() + vim.api.nvim_chan_send(term, '\027]11;?\027\\') + _G.result = vim.wait(3000, function() + local expected = '\027]11;?' + return _G.sequence == expected and _G.v_termrequest == expected + end) + end, + }) + ]]) + feed('i') + retry(nil, 4000, function() + eq(true, exec_lua('return _G.result')) + end) + end) + it('includes cursor position #31609', function() command('autocmd! nvim.terminal TermRequest') local screen = Screen.new(50, 10) |