diff options
author | zeertzjq <zeertzjq@outlook.com> | 2024-01-19 11:04:01 +0800 |
---|---|---|
committer | GitHub <noreply@github.com> | 2024-01-19 11:04:01 +0800 |
commit | ba9f86a9cee58dc32ab875da1fd7eac9bc9e88d7 (patch) | |
tree | 05595c1b509f1678ab2ed0670739ce3663fb559b /test/functional/ui/inccommand_user_spec.lua | |
parent | 78b000c74d631fb097bc2ada0c929153f96d9769 (diff) | |
download | rneovim-ba9f86a9cee58dc32ab875da1fd7eac9bc9e88d7.tar.gz rneovim-ba9f86a9cee58dc32ab875da1fd7eac9bc9e88d7.tar.bz2 rneovim-ba9f86a9cee58dc32ab875da1fd7eac9bc9e88d7.zip |
fix(inccommand): improve preview buffer number handling (#27087)
Diffstat (limited to 'test/functional/ui/inccommand_user_spec.lua')
-rw-r--r-- | test/functional/ui/inccommand_user_spec.lua | 18 |
1 files changed, 18 insertions, 0 deletions
diff --git a/test/functional/ui/inccommand_user_spec.lua b/test/functional/ui/inccommand_user_spec.lua index d30575a9f9..a714df72b7 100644 --- a/test/functional/ui/inccommand_user_spec.lua +++ b/test/functional/ui/inccommand_user_spec.lua @@ -1,6 +1,8 @@ local helpers = require('test.functional.helpers')(after_each) local Screen = require('test.functional.ui.screen') +local api = helpers.api local clear = helpers.clear +local eq = helpers.eq local exec_lua = helpers.exec_lua local insert = helpers.insert local feed = helpers.feed @@ -495,6 +497,22 @@ describe("'inccommand' for user commands", function() test_preview_break_undo() end) end) + + it('disables preview if preview buffer cannot be created #27086', function() + command('set inccommand=split') + api.nvim_buf_set_name(0, '[Preview]') + exec_lua([[ + vim.api.nvim_create_user_command('Test', function() end, { + nargs = '*', + preview = function(_, _, _) + return 2 + end + }) + ]]) + eq('split', api.nvim_get_option_value('inccommand', {})) + feed(':Test') + eq('nosplit', api.nvim_get_option_value('inccommand', {})) + end) end) describe("'inccommand' with multiple buffers", function() |