From c644228e1dfe9f70aae53292b328be98dc95b8f7 Mon Sep 17 00:00:00 2001 From: Marcus Caisey Date: Mon, 25 Nov 2024 22:33:11 +0000 Subject: fix(defaults): omit empty line from unimpaired mapping messages (#31347) Problem: The default unimpaired mappings display an empty line after the command's output. This results (with default configuration) in the `Press ENTER or type command to continue` prompt to be displayed, like so: ``` (2 of 16): item2 Press ENTER or type command to continue ``` Solution: The cause is that we're checking the second return value from `pcall(vim.api.nvim_cmd, opts, {})` to determine whether the call was successful. `nvim_cmd` returns an empty string on success, so this value is an empty string in the successful path which we then display. The fix is simple: check the first return value instead which is the "status code" of the call. --- test/functional/editor/defaults_spec.lua | 29 ++++++++++++++++++++++++++++- 1 file changed, 28 insertions(+), 1 deletion(-) (limited to 'test/functional/editor/defaults_spec.lua') diff --git a/test/functional/editor/defaults_spec.lua b/test/functional/editor/defaults_spec.lua index 82d285cc9a..3b0be5c9d9 100644 --- a/test/functional/editor/defaults_spec.lua +++ b/test/functional/editor/defaults_spec.lua @@ -95,7 +95,34 @@ describe('default', function() describe('key mappings', function() describe('unimpaired-style mappings', function() - it('do not show a full stack trace #30625', function() + it('show the command ouptut when successful', function() + n.clear({ args_rm = { '--cmd' } }) + local screen = Screen.new(40, 8) + n.fn.setqflist({ + { filename = 'file1', text = 'item1' }, + { filename = 'file2', text = 'item2' }, + }) + + n.feed(']q') + + screen:set_default_attr_ids({ + [1] = { foreground = Screen.colors.NvimDarkGrey4 }, + [2] = { + background = Screen.colors.NvimLightGray3, + foreground = Screen.colors.NvimDarkGrey3, + }, + }) + screen:expect({ + grid = [[ + ^ | + {1:~ }|*5 + {2:file2 0,0-1 All}| + (2 of 2): item2 | + ]], + }) + end) + + it('do not show a full stack trace when unsuccessful #30625', function() n.clear({ args_rm = { '--cmd' } }) local screen = Screen.new(40, 8) screen:set_default_attr_ids({ -- cgit From 8323398bc6081af3f79b220b886e3c0373129c7e Mon Sep 17 00:00:00 2001 From: zeertzjq Date: Thu, 5 Dec 2024 19:03:58 +0800 Subject: fix(defaults): don't replace keycodes in Visual search mappings (#31460) Also remove "silent" to be more consistent with Normal mode search. --- test/functional/editor/defaults_spec.lua | 68 ++++++++++++++++++++++++++++++++ 1 file changed, 68 insertions(+) (limited to 'test/functional/editor/defaults_spec.lua') diff --git a/test/functional/editor/defaults_spec.lua b/test/functional/editor/defaults_spec.lua index 3b0be5c9d9..b62c5afcfc 100644 --- a/test/functional/editor/defaults_spec.lua +++ b/test/functional/editor/defaults_spec.lua @@ -94,6 +94,74 @@ describe('default', function() end) describe('key mappings', function() + describe('Visual mode search mappings', function() + it('handle various chars properly', function() + n.clear({ args_rm = { '--cmd' } }) + local screen = Screen.new(60, 8) + screen:set_default_attr_ids({ + [1] = { foreground = Screen.colors.NvimDarkGray4 }, + [2] = { + foreground = Screen.colors.NvimDarkGray3, + background = Screen.colors.NvimLightGray3, + }, + [3] = { + foreground = Screen.colors.NvimLightGrey1, + background = Screen.colors.NvimDarkYellow, + }, + [4] = { + foreground = Screen.colors.NvimDarkGrey1, + background = Screen.colors.NvimLightYellow, + }, + }) + n.api.nvim_buf_set_lines(0, 0, -1, true, { + [[testing /?\!1]], + [[testing /?\!2]], + [[testing /?\!3]], + [[testing /?\!4]], + }) + n.feed('gg0vf!o*') + screen:expect([[ + {3:testing /?\!}1 | + {4:^testing /?\!}2 | + {3:testing /?\!}3 | + {3:testing /?\!}4 | + {1:~ }|*2 + {2:[No Name] [+] 2,1 All}| + /\Vtesting \/?\\! [2/4] | + ]]) + n.feed('n') + screen:expect([[ + {3:testing /?\!}1 | + {3:testing /?\!}2 | + {4:^testing /?\!}3 | + {3:testing /?\!}4 | + {1:~ }|*2 + {2:[No Name] [+] 3,1 All}| + /\Vtesting \/?\\! [3/4] | + ]]) + n.feed('G0vf!o#') + screen:expect([[ + {3:testing /?\!}1 | + {3:testing /?\!}2 | + {4:^testing /?\!}3 | + {3:testing /?\!}4 | + {1:~ }|*2 + {2:[No Name] [+] 3,1 All}| + ?\Vtesting /?\\! [3/4] | + ]]) + n.feed('n') + screen:expect([[ + {3:testing /?\!}1 | + {4:^testing /?\!}2 | + {3:testing /?\!}3 | + {3:testing /?\!}4 | + {1:~ }|*2 + {2:[No Name] [+] 2,1 All}| + ?\Vtesting /?\\! [2/4] | + ]]) + end) + end) + describe('unimpaired-style mappings', function() it('show the command ouptut when successful', function() n.clear({ args_rm = { '--cmd' } }) -- cgit From 09e01437c968be4c6e9f6bb3ac8811108c58008c Mon Sep 17 00:00:00 2001 From: Maria José Solano Date: Mon, 13 Jan 2025 19:45:11 -0800 Subject: refactor: use nvim.foo.bar format for autocommand groups --- test/functional/editor/defaults_spec.lua | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'test/functional/editor/defaults_spec.lua') diff --git a/test/functional/editor/defaults_spec.lua b/test/functional/editor/defaults_spec.lua index b62c5afcfc..ee6bfa1be9 100644 --- a/test/functional/editor/defaults_spec.lua +++ b/test/functional/editor/defaults_spec.lua @@ -32,7 +32,7 @@ describe('default', function() describe('popupmenu', function() it('can be disabled by user', function() n.clear { - args = { '+autocmd! nvim_popupmenu', '+aunmenu PopUp' }, + args = { '+autocmd! nvim.popupmenu', '+aunmenu PopUp' }, } local screen = Screen.new(40, 8) n.insert([[ -- cgit