aboutsummaryrefslogtreecommitdiff
path: root/test/functional/lua/buffer_updates_spec.lua
diff options
context:
space:
mode:
authorThomas Vigouroux <tomvig38@gmail.com>2020-12-15 22:18:35 +0100
committerThomas Vigouroux <tomvig38@gmail.com>2020-12-15 22:29:27 +0100
commit25e20da550b0d267013ac295756bad76f5fda7ef (patch)
tree6678ef7dae44dbc9419a25b5159cb1215554ab3b /test/functional/lua/buffer_updates_spec.lua
parentd0112693a3f442a6638114f1a9ef896a0bc5960b (diff)
downloadrneovim-25e20da550b0d267013ac295756bad76f5fda7ef.tar.gz
rneovim-25e20da550b0d267013ac295756bad76f5fda7ef.tar.bz2
rneovim-25e20da550b0d267013ac295756bad76f5fda7ef.zip
feat(buffer_updates): allow ignoring when previewing
Also adds a test that we actually subscribe to buffer events when in CMDPREVIEW.
Diffstat (limited to 'test/functional/lua/buffer_updates_spec.lua')
-rw-r--r--test/functional/lua/buffer_updates_spec.lua23
1 files changed, 20 insertions, 3 deletions
diff --git a/test/functional/lua/buffer_updates_spec.lua b/test/functional/lua/buffer_updates_spec.lua
index 7e4de7c39a..9f2b1b6e52 100644
--- a/test/functional/lua/buffer_updates_spec.lua
+++ b/test/functional/lua/buffer_updates_spec.lua
@@ -25,14 +25,14 @@ local function attach_buffer(evname)
local evname = ...
local events = {}
- function test_register(bufnr, id, changedtick, utf_sizes)
+ function test_register(bufnr, id, changedtick, utf_sizes, preview)
local function callback(...)
table.insert(events, {id, ...})
if test_unreg == id then
return true
end
end
- local opts = {[evname]=callback, on_detach=callback, utf_sizes=utf_sizes}
+ local opts = {[evname]=callback, on_detach=callback, utf_sizes=utf_sizes, preview=preview}
if changedtick then
opts.on_changedtick = callback
end
@@ -290,7 +290,7 @@ describe('lua: nvim_buf_attach on_bytes', function()
if verify then
meths.buf_get_offset(0, meths.buf_line_count(0))
end
- exec_lua("return test_register(...)", 0, "test1",false, nil)
+ exec_lua("return test_register(...)", 0, "test1", false, false, true)
meths.buf_get_changedtick(0)
local verify_name = "test1"
@@ -493,6 +493,23 @@ describe('lua: nvim_buf_attach on_bytes', function()
}
end)
+
+ it('inccomand=nosplit and substitute', function()
+ if verify then pending("Verification can't be done when previewing") end
+
+ local check_events = setup_eventcheck(verify, {"abcde"})
+ meths.set_option('inccommand', 'nosplit')
+
+ feed ':%s/bcd/'
+ check_events {
+ { "test1", "bytes", 1, 3, 0, 1, 1, 0, 3, 3, 0, 0, 0 };
+ }
+
+ feed 'a'
+ check_events {
+ { "test1", "bytes", 1, 3, 0, 1, 1, 0, 3, 3, 0, 1, 1 };
+ }
+ end)
end
describe('(with verify) handles', function()