mirror of
https://github.com/neovim/neovim.git
synced 2025-09-06 19:38:20 +00:00
test(paste): add tests with virtualedit=onemore
This commit is contained in:
@@ -636,6 +636,7 @@ describe('API', function()
|
|||||||
eq('Invalid phase: 4',
|
eq('Invalid phase: 4',
|
||||||
pcall_err(request, 'nvim_paste', 'foo', true, 4))
|
pcall_err(request, 'nvim_paste', 'foo', true, 4))
|
||||||
end)
|
end)
|
||||||
|
local function run_streamed_paste_tests()
|
||||||
it('stream: multiple chunks form one undo-block', function()
|
it('stream: multiple chunks form one undo-block', function()
|
||||||
nvim('paste', '1/chunk 1 (start)\n', true, 1)
|
nvim('paste', '1/chunk 1 (start)\n', true, 1)
|
||||||
nvim('paste', '1/chunk 2 (end)\n', true, 3)
|
nvim('paste', '1/chunk 2 (end)\n', true, 3)
|
||||||
@@ -741,7 +742,7 @@ describe('API', function()
|
|||||||
feed('i||<Esc>')
|
feed('i||<Esc>')
|
||||||
-- If nvim_paste() calls :undojoin without making any changes, this makes it an error.
|
-- If nvim_paste() calls :undojoin without making any changes, this makes it an error.
|
||||||
feed('afoo<Esc>u')
|
feed('afoo<Esc>u')
|
||||||
feed('$')
|
feed('2|')
|
||||||
end)
|
end)
|
||||||
after_each(function()
|
after_each(function()
|
||||||
feed('u')
|
feed('u')
|
||||||
@@ -773,7 +774,7 @@ describe('API', function()
|
|||||||
feed('i|xxx<CR>xxx|<Esc>')
|
feed('i|xxx<CR>xxx|<Esc>')
|
||||||
-- If nvim_paste() calls :undojoin without making any changes, this makes it an error.
|
-- If nvim_paste() calls :undojoin without making any changes, this makes it an error.
|
||||||
feed('afoo<Esc>u')
|
feed('afoo<Esc>u')
|
||||||
feed('hvhk')
|
feed('3|vhk')
|
||||||
end)
|
end)
|
||||||
after_each(function()
|
after_each(function()
|
||||||
feed('u')
|
feed('u')
|
||||||
@@ -808,7 +809,7 @@ describe('API', function()
|
|||||||
feed('i||xxx<CR>xxx<Esc>')
|
feed('i||xxx<CR>xxx<Esc>')
|
||||||
-- If nvim_paste() calls :undojoin without making any changes, this makes it an error.
|
-- If nvim_paste() calls :undojoin without making any changes, this makes it an error.
|
||||||
feed('afoo<Esc>u')
|
feed('afoo<Esc>u')
|
||||||
feed('vko')
|
feed('3|vko')
|
||||||
end)
|
end)
|
||||||
after_each(function()
|
after_each(function()
|
||||||
feed('u')
|
feed('u')
|
||||||
@@ -836,7 +837,7 @@ describe('API', function()
|
|||||||
feed('i||xxx<CR>xxx<Esc>')
|
feed('i||xxx<CR>xxx<Esc>')
|
||||||
-- If nvim_paste() calls :undojoin without making any changes, this makes it an error.
|
-- If nvim_paste() calls :undojoin without making any changes, this makes it an error.
|
||||||
feed('afoo<Esc>u')
|
feed('afoo<Esc>u')
|
||||||
feed('vk')
|
feed('3|vk')
|
||||||
end)
|
end)
|
||||||
after_each(function()
|
after_each(function()
|
||||||
feed('u')
|
feed('u')
|
||||||
@@ -994,6 +995,16 @@ describe('API', function()
|
|||||||
end)
|
end)
|
||||||
end)
|
end)
|
||||||
end)
|
end)
|
||||||
|
end
|
||||||
|
describe('without virtualedit,', function()
|
||||||
|
run_streamed_paste_tests()
|
||||||
|
end)
|
||||||
|
describe('with virtualedit=onemore,', function()
|
||||||
|
before_each(function()
|
||||||
|
command('set virtualedit=onemore')
|
||||||
|
end)
|
||||||
|
run_streamed_paste_tests()
|
||||||
|
end)
|
||||||
it('non-streaming', function()
|
it('non-streaming', function()
|
||||||
-- With final "\n".
|
-- With final "\n".
|
||||||
nvim('paste', 'line 1\nline 2\nline 3\n', true, -1)
|
nvim('paste', 'line 1\nline 2\nline 3\n', true, -1)
|
||||||
|
Reference in New Issue
Block a user