aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorMichael Davis2023-06-07 15:06:26 +0000
committerBlaž Hrastnik2023-06-07 15:48:25 +0000
commitb3949979ae72a7af84c34e69d2a2e17023bb8dbc (patch)
treeeaf25ef776cf8ac1acd86aa9e64f43b60f2d3c2f
parent0e083497a5bf24a51ffe2430dcf3a1cca7ad0f9a (diff)
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.
-rw-r--r--helix-term/src/commands.rs7
1 files changed, 5 insertions, 2 deletions
diff --git a/helix-term/src/commands.rs b/helix-term/src/commands.rs
index 1e89fe1c..0c24c693 100644
--- a/helix-term/src/commands.rs
+++ b/helix-term/src/commands.rs
@@ -2705,6 +2705,9 @@ impl ui::menu::Item for MappableCommand {
}
pub fn command_palette(cx: &mut Context) {
+ let register = cx.register;
+ let count = cx.count;
+
cx.callback = Some(Box::new(
move |compositor: &mut Compositor, cx: &mut compositor::Context| {
let keymap = compositor.find::<ui::EditorView>().unwrap().keymaps.map()
@@ -2722,8 +2725,8 @@ pub fn command_palette(cx: &mut Context) {
let picker = Picker::new(commands, keymap, move |cx, command, _action| {
let mut ctx = Context {
- register: None,
- count: std::num::NonZeroUsize::new(1),
+ register,
+ count,
editor: cx.editor,
callback: None,
on_next_key_callback: None,