Skip to content

Commit becd3bc

Browse files
committed
fixup! feat(extra): add <C-e> mapping for pickers.history
1 parent 90361ab commit becd3bc

File tree

4 files changed

+29
-54
lines changed

4 files changed

+29
-54
lines changed

doc/mini-extra.txt

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -512,15 +512,16 @@ Return ~
512512
`MiniExtra.pickers.history`({local_opts}, {opts})
513513
Neovim history picker
514514

515-
Pick from output of |:history|. Use `<C-e>` to edit current match in cmdline.
515+
Pick from output of |:history|. Use `<C-e>` to edit current match in
516+
Command line.
517+
516518
Notes:
517519
- Has no preview.
518520
- Choosing action depends on scope:
519521
- For "cmd" / ":" scopes, the command is executed.
520522
- For "search" / "/" / "?" scopes, search is redone.
521523
- For other scopes nothing is done (but chosen item is still returned).
522-
- `<C-e>` only works for "cmd" / ":" / "search" / "/" / "?" scopes. It does
523-
nothing for all other scopes.
524+
- `<C-e>` only works for "cmd" / ":" / "search" / "/" / "?" scopes.
524525

525526
Examples ~
526527

lua/mini/extra.lua

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -921,15 +921,16 @@ end
921921

922922
--- Neovim history picker
923923
---
924-
--- Pick from output of |:history|. Use `<C-e>` to edit current match in cmdline.
924+
--- Pick from output of |:history|. Use `<C-e>` to edit current match in
925+
--- Command line.
926+
---
925927
--- Notes:
926928
--- - Has no preview.
927929
--- - Choosing action depends on scope:
928930
--- - For "cmd" / ":" scopes, the command is executed.
929931
--- - For "search" / "/" / "?" scopes, search is redone.
930932
--- - For other scopes nothing is done (but chosen item is still returned).
931-
--- - `<C-e>` only works for "cmd" / ":" / "search" / "/" / "?" scopes. It does
932-
--- nothing for all other scopes.
933+
--- - `<C-e>` only works for "cmd" / ":" / "search" / "/" / "?" scopes.
933934
---
934935
--- Examples ~
935936
---

tests/screenshots/tests-test_extra.lua---pickers---history()---has-custom-'edit_command'-mapping

Lines changed: 0 additions & 43 deletions
This file was deleted.

tests/test_extra.lua

Lines changed: 21 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -767,6 +767,13 @@ local validate_global_source_options = function(picker_start, check_preview, che
767767
type_keys('<C-c>')
768768
end
769769

770+
local validate_cmdline = function(type, content)
771+
eq(child.fn.getcmdtype(), type)
772+
eq(child.fn.getcmdline(), content)
773+
774+
return type, content
775+
end
776+
770777
T['pickers']["validate no 'mini.pick'"] = function()
771778
child.lua([[require = function(module) error() end]])
772779

@@ -2470,19 +2477,28 @@ T['pickers']['history()']['has custom "edit_command" mapping'] = function()
24702477
eq(child.lua_get('MiniPick.get_picker_opts().mappings.edit_command.char'), '<C-e>')
24712478

24722479
type_keys(':', '<C-e>')
2473-
eq(child.fn.getcmdtype(), ':')
2474-
eq(child.fn.getcmdline(), 'lua _G.n = _G.n + 2')
2480+
validate_cmdline(':', 'lua _G.n = _G.n + 2')
24752481

24762482
type_keys('<C-c>')
24772483
pick_history()
24782484
type_keys('/', '<C-e>')
2479-
eq(child.fn.getcmdtype(), '/')
2480-
eq(child.fn.getcmdline(), 'bbb')
2485+
validate_cmdline('/', 'bbb')
24812486

24822487
type_keys('<C-c>')
24832488
pick_history()
24842489
type_keys('@', '<C-e>')
2485-
child.expect_screenshot({})
2490+
validate_cmdline('', '')
2491+
validate_active_picker()
2492+
2493+
type_keys('<C-c>')
2494+
pick_history({ scope = ':' })
2495+
type_keys('<C-e>')
2496+
validate_cmdline(':', 'lua _G.n = _G.n + 2')
2497+
2498+
type_keys('<C-c>')
2499+
pick_history({ scope = '/' })
2500+
type_keys('<C-e>')
2501+
validate_cmdline('/', 'bbb')
24862502
end
24872503

24882504
T['pickers']['hl_groups()'] = new_set()

0 commit comments

Comments
 (0)