From 0e083497a5bf24a51ffe2430dcf3a1cca7ad0f9a Mon Sep 17 00:00:00 2001 From: Michael Davis Date: Wed, 7 Jun 2023 09:55:16 -0500 Subject: [PATCH] Persist register selection in pending keymaps Previously the register selection (via `"`) would be lost in the middle of any key sequence longer than one key. For example, `f` would clear the register selection after the `` making it inaccessible for the `file_picker` command. This behavior does not currently have any effect in the default keymap but might affect custom keymaps. This change aligns the behavior of the register with count. Making this change allows propagating the register to the `command_palette` (see the child commit) or other pickers should we decide to use registers in those in the future. (Interactive global search for example.) --- helix-term/src/ui/editor.rs | 2 ++ 1 file changed, 2 insertions(+) diff --git a/helix-term/src/ui/editor.rs b/helix-term/src/ui/editor.rs index 43b5d1af..4f7916ff 100644 --- a/helix-term/src/ui/editor.rs +++ b/helix-term/src/ui/editor.rs @@ -943,6 +943,8 @@ impl EditorView { self.handle_keymap_event(mode, cxt, event); if self.keymaps.pending().is_empty() { cxt.editor.count = None + } else { + cxt.editor.selected_register = cxt.register.take(); } } }