diff options
author | zeertzjq <zeertzjq@outlook.com> | 2024-02-24 05:12:30 +0800 |
---|---|---|
committer | GitHub <noreply@github.com> | 2024-02-24 05:12:30 +0800 |
commit | 99288ecc77e429ffe06842157e72ed612e97a419 (patch) | |
tree | 182622c1d62dab9b16d30105067299d02066724d /test/functional/terminal/buffer_spec.lua | |
parent | cb5ae22eab1fbb3162d0f7440a48ad49c7b3c48e (diff) | |
download | rneovim-99288ecc77e429ffe06842157e72ed612e97a419.tar.gz rneovim-99288ecc77e429ffe06842157e72ed612e97a419.tar.bz2 rneovim-99288ecc77e429ffe06842157e72ed612e97a419.zip |
fix(terminal): block input when there is pending TermRequest (#27589)
Diffstat (limited to 'test/functional/terminal/buffer_spec.lua')
-rw-r--r-- | test/functional/terminal/buffer_spec.lua | 32 |
1 files changed, 30 insertions, 2 deletions
diff --git a/test/functional/terminal/buffer_spec.lua b/test/functional/terminal/buffer_spec.lua index 8dc52a4d5e..376b7b849e 100644 --- a/test/functional/terminal/buffer_spec.lua +++ b/test/functional/terminal/buffer_spec.lua @@ -319,8 +319,7 @@ describe(':terminal buffer', function() end) it('emits TermRequest events #26972', function() - command('split') - command('enew') + command('new') local term = api.nvim_open_term(0, {}) local termbuf = api.nvim_get_current_buf() @@ -336,6 +335,35 @@ describe(':terminal buffer', function() eq(expected, eval('v:termrequest')) eq(termbuf, eval('g:termbuf')) end) + + it('TermReqeust synchronization #27572', function() + command('new') + command('autocmd! nvim_terminal TermRequest') + local term = exec_lua([[ + _G.input = {} + local term = vim.api.nvim_open_term(0, { + on_input = function(_, _, _, data) + table.insert(_G.input, data) + end, + force_crlf = false, + }) + vim.api.nvim_create_autocmd('TermRequest', { + callback = function(args) + if args.data == '\027]11;?' then + table.insert(_G.input, '\027]11;rgb:0000/0000/0000\027\\') + end + end + }) + return term + ]]) + api.nvim_chan_send(term, '\027]11;?\007\027[5n\027]11;?\007\027[5n') + eq({ + '\027]11;rgb:0000/0000/0000\027\\', + '\027[0n', + '\027]11;rgb:0000/0000/0000\027\\', + '\027[0n', + }, exec_lua('return _G.input')) + end) end) describe('No heap-buffer-overflow when using', function() |