diff options
author | chentau <tchen1998@gmail.com> | 2021-06-11 00:41:54 -0700 |
---|---|---|
committer | chentau <tchen1998@gmail.com> | 2021-06-29 00:48:24 -0700 |
commit | 1c962401a10911e2766a5290f9b8171558c8fb40 (patch) | |
tree | 5dc6d2e8343fa065aef3e7b6c5cf1d0047e89dc9 /test/functional/lua/buffer_updates_spec.lua | |
parent | 1df8a34a7b91028413d6ac751b9dbf9fdcd6cda2 (diff) | |
download | rneovim-1c962401a10911e2766a5290f9b8171558c8fb40.tar.gz rneovim-1c962401a10911e2766a5290f9b8171558c8fb40.tar.bz2 rneovim-1c962401a10911e2766a5290f9b8171558c8fb40.zip |
Manually zero out deleted_bytes2 when substituting and joining lines
Diffstat (limited to 'test/functional/lua/buffer_updates_spec.lua')
-rw-r--r-- | test/functional/lua/buffer_updates_spec.lua | 33 |
1 files changed, 33 insertions, 0 deletions
diff --git a/test/functional/lua/buffer_updates_spec.lua b/test/functional/lua/buffer_updates_spec.lua index 1b2c21783e..a5b613f0b2 100644 --- a/test/functional/lua/buffer_updates_spec.lua +++ b/test/functional/lua/buffer_updates_spec.lua @@ -1001,6 +1001,39 @@ describe('lua: nvim_buf_attach on_bytes', function() } end) + it("flushes delbytes on substitute", function() + local check_events = setup_eventcheck(verify, {"AAA", "BBB", "CCC"}) + + feed("gg0") + command("s/AAA/GGG/") + + check_events { + { "test1", "bytes", 1, 3, 0, 0, 0, 0, 3, 3, 0, 3, 3 }; + } + + -- check that byte updates for :delete (which uses curbuf->deleted_bytes2) + -- are correct + command("delete") + check_events { + { "test1", "bytes", 1, 4, 0, 0, 0, 1, 0, 4, 0, 0, 0 }; + } + end) + + it("flushes delbytes on join", function() + local check_events = setup_eventcheck(verify, {"AAA", "BBB", "CCC"}) + + feed("gg0J") + + check_events { + { "test1", "bytes", 1, 3, 0, 3, 3, 1, 0, 1, 0, 1, 1 }; + } + + command("delete") + check_events { + { "test1", "bytes", 1, 5, 0, 0, 0, 1, 0, 8, 0, 0, 0 }; + } + end) + teardown(function() os.remove "Xtest-reload" os.remove "Xtest-undofile" |