diff options
author | Josh Rahm <rahm@google.com> | 2022-07-18 19:37:18 +0000 |
---|---|---|
committer | Josh Rahm <rahm@google.com> | 2022-07-18 19:37:18 +0000 |
commit | 308e1940dcd64aa6c344c403d4f9e0dda58d9c5c (patch) | |
tree | 35fe43e01755e0f312650667004487a44d6b7941 /test/functional/lua/buffer_updates_spec.lua | |
parent | 96a00c7c588b2f38a2424aeeb4ea3581d370bf2d (diff) | |
parent | e8c94697bcbe23a5c7b07c292b90a6b70aadfa87 (diff) | |
download | rneovim-308e1940dcd64aa6c344c403d4f9e0dda58d9c5c.tar.gz rneovim-308e1940dcd64aa6c344c403d4f9e0dda58d9c5c.tar.bz2 rneovim-308e1940dcd64aa6c344c403d4f9e0dda58d9c5c.zip |
Merge remote-tracking branch 'upstream/master' into rahm
Diffstat (limited to 'test/functional/lua/buffer_updates_spec.lua')
-rw-r--r-- | test/functional/lua/buffer_updates_spec.lua | 50 |
1 files changed, 44 insertions, 6 deletions
diff --git a/test/functional/lua/buffer_updates_spec.lua b/test/functional/lua/buffer_updates_spec.lua index c83a50b78b..10de45274c 100644 --- a/test/functional/lua/buffer_updates_spec.lua +++ b/test/functional/lua/buffer_updates_spec.lua @@ -252,9 +252,8 @@ describe('lua buffer event callbacks: on_lines', function() eq(2, meths.win_get_cursor(0)[1]) end) - it('does not SEGFAULT when calling win_findbuf in on_detach', function() - - exec_lua[[ + it('does not SEGFAULT when accessing window buffer info in on_detach #14998', function() + local code = [[ local buf = vim.api.nvim_create_buf(false, false) vim.cmd"split" @@ -262,13 +261,19 @@ describe('lua buffer event callbacks: on_lines', function() vim.api.nvim_buf_attach(buf, false, { on_detach = function(_, buf) + vim.fn.tabpagebuflist() vim.fn.win_findbuf(buf) end }) ]] + exec_lua(code) command("q!") helpers.assert_alive() + + exec_lua(code) + command("bd!") + helpers.assert_alive() end) it('#12718 lnume', function() @@ -612,7 +617,15 @@ describe('lua: nvim_buf_attach on_bytes', function() } feed("<esc>") - -- replacing with escaped characters + -- replacing with expression register + feed([[:%s/b/\=5+5]]) + check_events { + { "test1", "bytes", 1, 3, 0, 1, 1, 0, 1, 1, 0, 2, 2 }; + { "test1", "bytes", 1, 5, 0, 1, 1, 0, 2, 2, 0, 1, 1 }; + } + + feed("<esc>") + -- replacing with backslash feed([[:%s/b/\\]]) check_events { { "test1", "bytes", 1, 3, 0, 1, 1, 0, 1, 1, 0, 1, 1 }; @@ -620,8 +633,24 @@ describe('lua: nvim_buf_attach on_bytes', function() } feed("<esc>") - -- replacing with expression register - feed([[:%s/b/\=5+5]]) + -- replacing with backslash from expression register + feed([[:%s/b/\='\']]) + check_events { + { "test1", "bytes", 1, 3, 0, 1, 1, 0, 1, 1, 0, 1, 1 }; + { "test1", "bytes", 1, 5, 0, 1, 1, 0, 1, 1, 0, 1, 1 }; + } + + feed("<esc>") + -- replacing with backslash followed by another character + feed([[:%s/b/\\!]]) + check_events { + { "test1", "bytes", 1, 3, 0, 1, 1, 0, 1, 1, 0, 2, 2 }; + { "test1", "bytes", 1, 5, 0, 1, 1, 0, 2, 2, 0, 1, 1 }; + } + + feed("<esc>") + -- replacing with backslash followed by another character from expression register + feed([[:%s/b/\='\!']]) check_events { { "test1", "bytes", 1, 3, 0, 1, 1, 0, 1, 1, 0, 2, 2 }; { "test1", "bytes", 1, 5, 0, 1, 1, 0, 2, 2, 0, 1, 1 }; @@ -1104,6 +1133,15 @@ describe('lua: nvim_buf_attach on_bytes', function() check_events { } end) + it("works with accepting spell suggestions", function() + local check_events = setup_eventcheck(verify, {"hallo"}) + + feed("gg0z=4<cr><cr>") -- accepts 'Hello' + check_events { + { "test1", "bytes", 1, 3, 0, 0, 0, 0, 2, 2, 0, 2, 2 }; + } + end) + local function test_lockmarks(mode) local description = (mode ~= "") and mode or "(baseline)" it("test_lockmarks " .. description .. " %delete _", function() |