mirror of
https://github.com/neovim/neovim.git
synced 2025-09-24 20:18:32 +00:00
backport: fix(:source, nvim_exec): handle Vimscript line continuations #14809
Problem: Anonymous :source (no args) and nvim_exec() don't support Vimscript line continuations. Solution: Factor out the concat logic into concat_continued_line() and a CONCAT_CONTINUED_LINES macro for simple concatenations where lines are fetched individually. Closes #14807
This commit is contained in:
@@ -115,6 +115,19 @@ describe('API', function()
|
||||
nvim('exec','autocmd BufAdd * :let x1 = "Hello"', false)
|
||||
nvim('command', 'new foo')
|
||||
eq('Hello', request('nvim_eval', 'g:x1'))
|
||||
|
||||
-- Line continuations
|
||||
nvim('exec', [[
|
||||
let abc = #{
|
||||
\ a: 1,
|
||||
"\ b: 2,
|
||||
\ c: 3
|
||||
\ }]], false)
|
||||
eq({a = 1, c = 3}, request('nvim_eval', 'g:abc'))
|
||||
|
||||
-- try no spaces before continuations to catch off-by-one error
|
||||
nvim('exec', 'let ab = #{\n\\a: 98,\n"\\ b: 2\n\\}', false)
|
||||
eq({a = 98}, request('nvim_eval', 'g:ab'))
|
||||
end)
|
||||
|
||||
it('non-ASCII input', function()
|
||||
|
Reference in New Issue
Block a user