vim-patch:8.2.4603: sourcing buffer lines is too complicated

Problem:    Sourcing buffer lines is too complicated.
Solution:   Simplify the code. Make it possible to source Vim9 script lines.
            (Yegappan Lakshmanan, closes vim/vim#9974)

85b43c6cb7

This commit changes the behavior of sourcing buffer lines to always have
a script ID, although sourcing the same buffer always produces the same
script ID.

vim-patch:9.1.0372: Calling CLEAR_FIELD() on the same struct twice

Problem:  Calling CLEAR_FIELD() on the same struct twice.
Solution: Remove the second CLEAR_FIELD().  Move the assignment of
          cookie.sourceing_lnum (zeertzjq).

closes: vim/vim#14627

f68517c167

Co-authored-by: Yegappan Lakshmanan <yegappan@yahoo.com>
This commit is contained in:
zeertzjq
2024-04-24 16:20:19 +08:00
parent a3a9f86d4a
commit 6750d00fe9
13 changed files with 748 additions and 213 deletions

View File

@@ -42,59 +42,62 @@ describe('named marks', function()
it('errors when set out of range with :mark', function()
command('edit ' .. file1)
local err = pcall_err(n.exec_capture, '1000mark x')
eq('nvim_exec2(): Vim(mark):E16: Invalid range: 1000mark x', err)
eq('nvim_exec2(), line 1: Vim(mark):E16: Invalid range: 1000mark x', err)
end)
it('errors when set out of range with :k', function()
command('edit ' .. file1)
local err = pcall_err(n.exec_capture, '1000kx')
eq('nvim_exec2(): Vim(k):E16: Invalid range: 1000kx', err)
eq('nvim_exec2(), line 1: Vim(k):E16: Invalid range: 1000kx', err)
end)
it('errors on unknown mark name with :mark', function()
command('edit ' .. file1)
local err = pcall_err(n.exec_capture, 'mark #')
eq('nvim_exec2(): Vim(mark):E191: Argument must be a letter or forward/backward quote', err)
eq(
'nvim_exec2(), line 1: Vim(mark):E191: Argument must be a letter or forward/backward quote',
err
)
end)
it("errors on unknown mark name with '", function()
command('edit ' .. file1)
local err = pcall_err(n.exec_capture, "normal! '#")
eq('nvim_exec2(): Vim(normal):E78: Unknown mark', err)
eq('nvim_exec2(), line 1: Vim(normal):E78: Unknown mark', err)
end)
it('errors on unknown mark name with `', function()
command('edit ' .. file1)
local err = pcall_err(n.exec_capture, 'normal! `#')
eq('nvim_exec2(): Vim(normal):E78: Unknown mark', err)
eq('nvim_exec2(), line 1: Vim(normal):E78: Unknown mark', err)
end)
it("errors when moving to a mark that is not set with '", function()
command('edit ' .. file1)
local err = pcall_err(n.exec_capture, "normal! 'z")
eq('nvim_exec2(): Vim(normal):E20: Mark not set', err)
eq('nvim_exec2(), line 1: Vim(normal):E20: Mark not set', err)
err = pcall_err(n.exec_capture, "normal! '.")
eq('nvim_exec2(): Vim(normal):E20: Mark not set', err)
eq('nvim_exec2(), line 1: Vim(normal):E20: Mark not set', err)
end)
it('errors when moving to a mark that is not set with `', function()
command('edit ' .. file1)
local err = pcall_err(n.exec_capture, 'normal! `z')
eq('nvim_exec2(): Vim(normal):E20: Mark not set', err)
eq('nvim_exec2(), line 1: Vim(normal):E20: Mark not set', err)
err = pcall_err(n.exec_capture, 'normal! `>')
eq('nvim_exec2(): Vim(normal):E20: Mark not set', err)
eq('nvim_exec2(), line 1: Vim(normal):E20: Mark not set', err)
end)
it("errors when moving to a global mark that is not set with '", function()
command('edit ' .. file1)
local err = pcall_err(n.exec_capture, "normal! 'Z")
eq('nvim_exec2(): Vim(normal):E20: Mark not set', err)
eq('nvim_exec2(), line 1: Vim(normal):E20: Mark not set', err)
end)
it('errors when moving to a global mark that is not set with `', function()
command('edit ' .. file1)
local err = pcall_err(n.exec_capture, 'normal! `Z')
eq('nvim_exec2(): Vim(normal):E20: Mark not set', err)
eq('nvim_exec2(), line 1: Vim(normal):E20: Mark not set', err)
end)
it("can move to them using '", function()
@@ -169,7 +172,7 @@ describe('named marks', function()
command('next')
command('bw! ' .. file1)
local err = pcall_err(n.exec_capture, "normal! 'A")
eq('nvim_exec2(): Vim(normal):E92: Buffer 1 not found', err)
eq('nvim_exec2(), line 1: Vim(normal):E92: Buffer 1 not found', err)
os.remove(file1)
end)