aboutsummaryrefslogtreecommitdiff
path: root/test/functional/lua/buffer_updates_spec.lua
diff options
context:
space:
mode:
authorThomas Vigouroux <tomvig38@gmail.com>2020-09-18 08:44:32 +0200
committerThomas Vigouroux <tomvig38@gmail.com>2020-09-18 17:54:49 +0200
commit179f0bca1890637f47e76c8acfd33040a6b7d515 (patch)
tree551c89be8be222f827a2bdc1e481c48b10710593 /test/functional/lua/buffer_updates_spec.lua
parent6dc815530b7b127c5b5e0912783c3f2118cb184f (diff)
downloadrneovim-179f0bca1890637f47e76c8acfd33040a6b7d515.tar.gz
rneovim-179f0bca1890637f47e76c8acfd33040a6b7d515.tar.bz2
rneovim-179f0bca1890637f47e76c8acfd33040a6b7d515.zip
buf_updates: fix wrong updates on linewise change
Diffstat (limited to 'test/functional/lua/buffer_updates_spec.lua')
-rw-r--r--test/functional/lua/buffer_updates_spec.lua24
1 files changed, 24 insertions, 0 deletions
diff --git a/test/functional/lua/buffer_updates_spec.lua b/test/functional/lua/buffer_updates_spec.lua
index ac5d25bdab..6b62768470 100644
--- a/test/functional/lua/buffer_updates_spec.lua
+++ b/test/functional/lua/buffer_updates_spec.lua
@@ -289,6 +289,12 @@ describe('lua: nvim_buf_attach on_bytes', function()
if verify then
for _, event in ipairs(events) do
+ for _, elem in ipairs(event) do
+ if type(elem) == "number" and elem < 0 then
+ fail(string.format("Received event has negative values"))
+ end
+ end
+
if event[1] == verify_name and event[2] == "bytes" then
local _, _, _, _, _, _, start_byte, _, _, old_byte, _, _, new_byte = unpack(event)
local before = string.sub(shadowbytes, 1, start_byte)
@@ -411,6 +417,24 @@ describe('lua: nvim_buf_attach on_bytes', function()
{ "test1", "bytes", 1, 3, 0, 0, 0, 0, 0, 0, 0, 1, 1 };
}
end)
+
+ it("changing lines", function()
+ local check_events = setup_eventcheck(verify, origlines)
+
+ feed "cc"
+ check_events {
+ { "test1", "bytes", 1, 4, 1, 0, 1, 0, 15, 15, 0, 0, 0 };
+ }
+
+ feed "<ESC>"
+ check_events {}
+
+ feed "c3j"
+ check_events {
+ { "test1", "bytes", 1, 4, 1, 0, 1, 3, 0, 48, 0, 0, 0 };
+ { "test1", "bytes", 1, 5, 0, 0, 0, 4, 0, 0, 4, 0, 51 };
+ }
+ end)
end
describe('(with verify) handles', function()