paste: one undo-block per stream

- All "chunks" in a paste-stream should form a single undo-block. Side
  effect of 7a85792884 was to create an undo-block for each chunk.
- Also: remove old :redraw force logic, irrelevant after 7a85792884.
This commit is contained in:
Justin M. Keyes
2019-08-31 12:44:42 +02:00
parent 801fe799ff
commit 976c6667e1
5 changed files with 41 additions and 14 deletions

View File

@@ -373,6 +373,35 @@ describe('API', function()
expect_err('Invalid phase: 4', request,
'nvim_paste', 'foo', true, 4)
end)
it('stream: multiple chunks form one undo-block', function()
nvim('paste', '1/chunk 1 (start)\n', true, 1)
nvim('paste', '1/chunk 2 (end)\n', true, 3)
local expected1 = [[
1/chunk 1 (start)
1/chunk 2 (end)
]]
expect(expected1)
nvim('paste', '2/chunk 1 (start)\n', true, 1)
nvim('paste', '2/chunk 2\n', true, 2)
expect([[
1/chunk 1 (start)
1/chunk 2 (end)
2/chunk 1 (start)
2/chunk 2
]])
nvim('paste', '2/chunk 3\n', true, 2)
nvim('paste', '2/chunk 4 (end)\n', true, 3)
expect([[
1/chunk 1 (start)
1/chunk 2 (end)
2/chunk 1 (start)
2/chunk 2
2/chunk 3
2/chunk 4 (end)
]])
feed('u') -- Undo.
expect(expected1)
end)
it('non-streaming', function()
-- With final "\n".
nvim('paste', 'line 1\nline 2\nline 3\n', true, -1)