on master help sign in
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.

commitb3949979ae72a7af84c34e69d2a2e17023bb8dbc authorMichael Davis <mcarsondavis@gmail.com> dateWed 7 Jun 2023, 10:06 (3 years ago) parent0e08349
1 file changed+5−2
helix-term/src/commands.rs+5−2
helix-term/src/commands.rs+5−2
@@ -2705,6 +2705,9 @@ impl ui::menu::Item for MappableCommand {
27052705}
27062706
27072707pub 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,