diff options
| author | Volodymyr Chernetskyi <volodymyr_chernetskyi@goodyear.com> | 2026-09-24 20:26:17 +0200 |
|---|---|---|
| committer | GitHub <noreply@github.com> | 2026-09-24 14:26:17 -0400 |
| commit | 8aae4c104640bc4fd17fd51b2eb41efe7ee460cd (patch) | |
| tree | e30820e764e2282e3eef3a58ab9ba43b737495d4 /test/functional/lua | |
| parent | ebc4f234c28d2308d2ed049d2bbcb3c9d44ad3da (diff) | |
| download | rneovim-8aae4c104640bc4fd17fd51b2eb41efe7ee460cd.tar.gz rneovim-8aae4c104640bc4fd17fd51b2eb41efe7ee460cd.tar.bz2 rneovim-8aae4c104640bc4fd17fd51b2eb41efe7ee460cd.zip | |
fix(ui): ui.open() modifies opts.cmd #41885
Problem:
ui.open() appends the path to the caller's opts.cmd, so reusing the
opts opens previously supplied paths again.
Solution:
Copy opt.cmd before appending the path.
Diffstat (limited to 'test/functional/lua')
| -rw-r--r-- | test/functional/lua/ui_spec.lua | 11 |
1 files changed, 11 insertions, 0 deletions
diff --git a/test/functional/lua/ui_spec.lua b/test/functional/lua/ui_spec.lua index 04646c202e..6dd4bba060 100644 --- a/test/functional/lua/ui_spec.lua +++ b/test/functional/lua/ui_spec.lua @@ -174,6 +174,17 @@ describe('vim.ui', function() ) end) + it('can reuse opt.cmd without accumulating paths', function() + eq( + 'arg1=arg1;arg2=https://example.com/second;', + exec_lua(function(opener) + local opts = { cmd = { opener, 'arg1' } } + vim.ui.open('https://example.com/first', opts):wait() + return vim.ui.open('https://example.com/second', opts):wait().stdout + end, n.testprg('printargs-test')) + ) + end) + it('gx on a help tag opens URL', function() n.command('helptags $VIMRUNTIME/doc') n.command('help nvim.txt') |