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-core | |
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-core')
-rw-r--r-- | helix-core/src/register.rs | 13 |
1 files changed, 6 insertions, 7 deletions
diff --git a/helix-core/src/register.rs b/helix-core/src/register.rs index 0be0ce89..0176d23e 100644 --- a/helix-core/src/register.rs +++ b/helix-core/src/register.rs @@ -6,16 +6,15 @@ use std::{collections::HashMap, sync::RwLock}; static REGISTRY: Lazy<RwLock<HashMap<char, Vec<String>>>> = Lazy::new(|| RwLock::new(HashMap::new())); -pub fn get(register: char) -> Option<Vec<String>> { +/// Read register values. +pub fn get(register_name: char) -> Option<Vec<String>> { let registry = REGISTRY.read().unwrap(); - - // TODO: no cloning - registry.get(®ister).cloned() + registry.get(®ister_name).cloned() // TODO: no cloning } +/// Read register values. // restoring: bool -pub fn set(register: char, values: Vec<String>) { +pub fn set(register_name: char, values: Vec<String>) { let mut registry = REGISTRY.write().unwrap(); - - registry.insert(register, values); + registry.insert(register_name, values); } |