diff options
author | Benoît CORTIER | 2021-06-05 02:21:31 +0000 |
---|---|---|
committer | Blaž Hrastnik | 2021-06-07 12:52:09 +0000 |
commit | 68affa3c598723a8b9451ef3dcceda83ae161e39 (patch) | |
tree | 06a6c0ed9f6e0483b138b44d969f4341206cf4c0 /helix-term/src/ui | |
parent | d5de9183ef8392168b06131278554e483eddfff3 (diff) |
Implement register selection
User can select register to yank into with the " command.
A new state is added to `Editor` and `commands::Context` structs.
This state is managed by leveraging a new struct `RegisterSelection`.
Diffstat (limited to 'helix-term/src/ui')
-rw-r--r-- | helix-term/src/ui/editor.rs | 8 |
1 files changed, 6 insertions, 2 deletions
diff --git a/helix-term/src/ui/editor.rs b/helix-term/src/ui/editor.rs index cd66b703..4f485ed2 100644 --- a/helix-term/src/ui/editor.rs +++ b/helix-term/src/ui/editor.rs @@ -537,6 +537,9 @@ impl EditorView { // if this fails, count was Some(0) // debug_assert!(cxt.count != 0); + // set the register + cxt.register = cxt.editor.register.take(); + if let Some(command) = self.keymap[&mode].get(&event) { command(cxt); } @@ -575,11 +578,12 @@ impl Component for EditorView { let mode = doc.mode(); let mut cxt = commands::Context { - editor: &mut cx.editor, + register: helix_view::RegisterSelection::default(), count: 1, + editor: &mut cx.editor, callback: None, - callbacks: cx.callbacks, on_next_key_callback: None, + callbacks: cx.callbacks, }; if let Some(on_next_key) = self.on_next_key.take() { |