From ba515622fb84e6c570e12743630e75acf5f83839 Mon Sep 17 00:00:00 2001 From: KillTheMule Date: Sat, 8 Aug 2020 15:33:41 +0200 Subject: Fix buffer_updates on blockwise paste Fixes #12718. --- test/functional/lua/buffer_updates_spec.lua | 25 +++++++++++++++++++++++++ 1 file changed, 25 insertions(+) (limited to 'test/functional/lua/buffer_updates_spec.lua') diff --git a/test/functional/lua/buffer_updates_spec.lua b/test/functional/lua/buffer_updates_spec.lua index 439cc12192..ac3048aafd 100644 --- a/test/functional/lua/buffer_updates_spec.lua +++ b/test/functional/lua/buffer_updates_spec.lua @@ -245,6 +245,31 @@ describe('lua buffer event callbacks: on_lines', function() helpers.assert_alive() end) + it('#12718 lnume', function() + meths.buf_set_lines(0, 0, -1, true, {'1', '2', '3'}) + exec_lua([[ + vim.api.nvim_buf_attach(0, false, { + on_lines = function(...) + vim.api.nvim_set_var('linesev', { ... }) + end, + }) + ]]) + feed('1G0') + feed('y2j') + feed('G0') + feed('p') + -- Is the last arg old_byte_size correct? Doesn't matter for this PR + eq(meths.get_var('linesev'), { "lines", 1, 4, 2, 3, 5, 4 }) + + feed('2G0') + feed('p') + eq(meths.get_var('linesev'), { "lines", 1, 5, 1, 4, 4, 8 }) + + feed('1G0') + feed('P') + eq(meths.get_var('linesev'), { "lines", 1, 6, 0, 3, 3, 9 }) + + end) end) describe('lua: nvim_buf_attach on_bytes', function() -- cgit From c1a740ae339c0d4de79ad5b82d540a671bd90505 Mon Sep 17 00:00:00 2001 From: Thomas Vigouroux Date: Wed, 30 Sep 2020 15:16:20 +0200 Subject: bytetrack: add blockwise paste test --- test/functional/lua/buffer_updates_spec.lua | 30 +++++++++++++++++++++++++++++ 1 file changed, 30 insertions(+) (limited to 'test/functional/lua/buffer_updates_spec.lua') diff --git a/test/functional/lua/buffer_updates_spec.lua b/test/functional/lua/buffer_updates_spec.lua index ac3048aafd..2a1ad210c1 100644 --- a/test/functional/lua/buffer_updates_spec.lua +++ b/test/functional/lua/buffer_updates_spec.lua @@ -477,6 +477,36 @@ describe('lua: nvim_buf_attach on_bytes', function() { "test1", "bytes", 1, 5, 0, 0, 0, 0, 0, 0, 0, 3, 3 }; } end) + + it('blockwise paste', function() + local check_events = setup_eventcheck(verify, {'1', '2', '3'}) + feed('1G0') + feed('y2j') + feed('G0') + feed('p') + check_events { + { "test1", "bytes", 1, 3, 2, 1, 5, 0, 0, 0, 0, 1, 1 }; + { "test1", "bytes", 1, 3, 3, 0, 7, 0, 0, 0, 0, 2, 2 }; + { "test1", "bytes", 1, 3, 4, 0, 10, 0, 0, 0, 0, 2, 2 }; + } + + feed('2G0') + feed('p') + check_events { + { "test1", "bytes", 1, 4, 1, 1, 3, 0, 0, 0, 0, 1, 1 }; + { "test1", "bytes", 1, 4, 2, 1, 6, 0, 0, 0, 0, 1, 1 }; + { "test1", "bytes", 1, 4, 3, 1, 10, 0, 0, 0, 0, 1, 1 }; + } + + feed('1G0') + feed('P') + check_events { + { "test1", "bytes", 1, 5, 0, 0, 0, 0, 0, 0, 0, 1, 1 }; + { "test1", "bytes", 1, 5, 1, 0, 3, 0, 0, 0, 0, 1, 1 }; + { "test1", "bytes", 1, 5, 2, 0, 7, 0, 0, 0, 0, 1, 1 }; + } + + end) end describe('(with verify) handles', function() -- cgit From 02dcc3c11ad72e0ae3c6704af6b08d9275ed5470 Mon Sep 17 00:00:00 2001 From: KillTheMule Date: Wed, 30 Sep 2020 21:28:21 +0200 Subject: Fix byte updates for blockwise paste at buffer end --- test/functional/lua/buffer_updates_spec.lua | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) (limited to 'test/functional/lua/buffer_updates_spec.lua') diff --git a/test/functional/lua/buffer_updates_spec.lua b/test/functional/lua/buffer_updates_spec.lua index 2a1ad210c1..fa31880782 100644 --- a/test/functional/lua/buffer_updates_spec.lua +++ b/test/functional/lua/buffer_updates_spec.lua @@ -486,8 +486,8 @@ describe('lua: nvim_buf_attach on_bytes', function() feed('p') check_events { { "test1", "bytes", 1, 3, 2, 1, 5, 0, 0, 0, 0, 1, 1 }; - { "test1", "bytes", 1, 3, 3, 0, 7, 0, 0, 0, 0, 2, 2 }; - { "test1", "bytes", 1, 3, 4, 0, 10, 0, 0, 0, 0, 2, 2 }; + { "test1", "bytes", 1, 3, 3, 0, 7, 0, 0, 0, 0, 3, 3 }; + { "test1", "bytes", 1, 3, 4, 0, 10, 0, 0, 0, 0, 3, 3 }; } feed('2G0') -- cgit