Skip to content

Commit b394997

Browse files
the-mikedavisarchseer
authored andcommitted
Propagate the count and register to command palette commands
Previously a count or register selection would be lost while opening the command palette. This change allows using a register selection or count in any command chosen from the command palette.
1 parent 0e08349 commit b394997

File tree

1 file changed

+5
-2
lines changed

1 file changed

+5
-2
lines changed

helix-term/src/commands.rs

+5-2
Original file line numberDiff line numberDiff line change
@@ -2705,6 +2705,9 @@ impl ui::menu::Item for MappableCommand {
27052705
}
27062706

27072707
pub fn command_palette(cx: &mut Context) {
2708+
let register = cx.register;
2709+
let count = cx.count;
2710+
27082711
cx.callback = Some(Box::new(
27092712
move |compositor: &mut Compositor, cx: &mut compositor::Context| {
27102713
let keymap = compositor.find::<ui::EditorView>().unwrap().keymaps.map()
@@ -2722,8 +2725,8 @@ pub fn command_palette(cx: &mut Context) {
27222725

27232726
let picker = Picker::new(commands, keymap, move |cx, command, _action| {
27242727
let mut ctx = Context {
2725-
register: None,
2726-
count: std::num::NonZeroUsize::new(1),
2728+
register,
2729+
count,
27272730
editor: cx.editor,
27282731
callback: None,
27292732
on_next_key_callback: None,

0 commit comments

Comments
 (0)