aboutsummaryrefslogtreecommitdiff
path: root/test/functional/lua/buffer_updates_spec.lua
diff options
context:
space:
mode:
authorThomas Vigouroux <tomvig38@gmail.com>2020-09-30 22:34:41 +0200
committerGitHub <noreply@github.com>2020-09-30 22:34:41 +0200
commitc007b961f53e0a38fdec23bac4777493dceeab12 (patch)
tree439ad79a0ec632c7ac8b4e40bf0d05169ffecfcd /test/functional/lua/buffer_updates_spec.lua
parente5d98d85693245fec811307e5a2ccfdea3a350cd (diff)
parent02dcc3c11ad72e0ae3c6704af6b08d9275ed5470 (diff)
downloadrneovim-c007b961f53e0a38fdec23bac4777493dceeab12.tar.gz
rneovim-c007b961f53e0a38fdec23bac4777493dceeab12.tar.bz2
rneovim-c007b961f53e0a38fdec23bac4777493dceeab12.zip
Merge pull request #12733 from KillTheMule/lnume
[RDY]: Fix buffer_updates on blockwise paste
Diffstat (limited to 'test/functional/lua/buffer_updates_spec.lua')
-rw-r--r--test/functional/lua/buffer_updates_spec.lua55
1 files changed, 55 insertions, 0 deletions
diff --git a/test/functional/lua/buffer_updates_spec.lua b/test/functional/lua/buffer_updates_spec.lua
index 439cc12192..fa31880782 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('y<C-v>2j')
+ 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()
@@ -452,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('y<C-v>2j')
+ 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, 3, 3 };
+ { "test1", "bytes", 1, 3, 4, 0, 10, 0, 0, 0, 0, 3, 3 };
+ }
+
+ 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()