From 8335e26b2d0226f5b50fb4a9c4e6d37919aeb212 Mon Sep 17 00:00:00 2001 From: Björn Linse Date: Thu, 7 Oct 2021 19:35:49 +0200 Subject: fix(buffer_updates): handle :delete of the very last line in buffer --- test/functional/lua/buffer_updates_spec.lua | 25 +++++++++++++++++++++++++ 1 file changed, 25 insertions(+) (limited to 'test/functional/lua') diff --git a/test/functional/lua/buffer_updates_spec.lua b/test/functional/lua/buffer_updates_spec.lua index aa92c36918..42b3d86eb0 100644 --- a/test/functional/lua/buffer_updates_spec.lua +++ b/test/functional/lua/buffer_updates_spec.lua @@ -1063,6 +1063,31 @@ describe('lua: nvim_buf_attach on_bytes', function() } end) + it("delete in completely empty buffer", function() + local check_events = setup_eventcheck(verify, nil) + + command "delete" + check_events { } + end) + + it("delete the only line of a buffer", function() + local check_events = setup_eventcheck(verify, {"AAA"}) + + command "delete" + check_events { + { "test1", "bytes", 1, 3, 0, 0, 0, 1, 0, 4, 1, 0, 1 }; + } + end) + + it("delete the last line of a buffer with two lines", function() + local check_events = setup_eventcheck(verify, {"AAA", "BBB"}) + + command "2delete" + check_events { + { "test1", "bytes", 1, 3, 1, 0, 4, 1, 0, 4, 0, 0, 0 }; + } + end) + teardown(function() os.remove "Xtest-reload" os.remove "Xtest-undofile" -- cgit