diff options
author | zeertzjq <zeertzjq@outlook.com> | 2023-05-29 08:44:52 +0800 |
---|---|---|
committer | GitHub <noreply@github.com> | 2023-05-29 08:44:52 +0800 |
commit | 9dd48f7832f4656af4a2579368641268bb6399e7 (patch) | |
tree | 450b71c546d2a62d4c07bd55fb119852ce8fa39d /test/functional/ui/inccommand_user_spec.lua | |
parent | c48f94d1f30056272ed030ad3f4529055ac07853 (diff) | |
download | rneovim-9dd48f7832f4656af4a2579368641268bb6399e7.tar.gz rneovim-9dd48f7832f4656af4a2579368641268bb6399e7.tar.bz2 rneovim-9dd48f7832f4656af4a2579368641268bb6399e7.zip |
fix(substitute): properly check if preview is needed (#23809)
Diffstat (limited to 'test/functional/ui/inccommand_user_spec.lua')
-rw-r--r-- | test/functional/ui/inccommand_user_spec.lua | 34 |
1 files changed, 34 insertions, 0 deletions
diff --git a/test/functional/ui/inccommand_user_spec.lua b/test/functional/ui/inccommand_user_spec.lua index 6329ece40a..9cc6e095c5 100644 --- a/test/functional/ui/inccommand_user_spec.lua +++ b/test/functional/ui/inccommand_user_spec.lua @@ -401,6 +401,40 @@ describe("'inccommand' for user commands", function() feed('e') assert_alive() end) + + it('no crash when adding highlight after :substitute #21495', function() + command('set inccommand=nosplit') + exec_lua([[ + vim.api.nvim_create_user_command("Crash", function() end, { + preview = function(_, preview_ns, _) + vim.cmd("%s/text/cats/g") + vim.api.nvim_buf_add_highlight(0, preview_ns, "Search", 0, 0, -1) + return 1 + end, + }) + ]]) + feed(':C') + screen:expect([[ + {1: cats on line 1} | + more cats on line 2 | + oh no, even more cats | + will the cats ever stop | + oh well | + did the cats stop | + why won't it stop | + make the cats stop | + | + {2:~ }| + {2:~ }| + {2:~ }| + {2:~ }| + {2:~ }| + {2:~ }| + {2:~ }| + :C^ | + ]]) + assert_alive() + end) end) describe("'inccommand' with multiple buffers", function() |