From 8aae4c104640bc4fd17fd51b2eb41efe7ee460cd Mon Sep 17 00:00:00 2001 From: Volodymyr Chernetskyi Date: Thu, 24 Sep 2026 20:26:17 +0200 Subject: 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. --- test/functional/lua/ui_spec.lua | 11 +++++++++++ 1 file changed, 11 insertions(+) (limited to 'test/functional/lua') 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') -- cgit