fix(api): nvim_parse_cmd handle nextcmd for commands without EX_TRLBAR (#36055)

Problem: nvim_parse_cmd('exe "ls"|edit foo', {}) fails to separate
nextcmd, returning args as { '"ls"|edit', 'foo' } instead of { '"ls"' }
with nextcmd='edit foo'.

Solution: Skip expressions before checking for '|' separator.
This commit is contained in:
glepnir
2025-10-13 07:36:06 +08:00
committed by GitHub
parent b0edab3631
commit 72b0bfa1fb
3 changed files with 34 additions and 5 deletions

View File

@@ -4849,6 +4849,12 @@ describe('API', function()
result = api.nvim_parse_cmd('copen 5', {})
eq(5, result.count)
end)
it('parses nextcmd for commands #36029', function()
local result = api.nvim_parse_cmd('exe "ls"|edit foo', {})
eq({ '"ls"' }, result.args)
eq('execute', result.cmd)
eq('edit foo', result.nextcmd)
end)
end)
describe('nvim_cmd', function()