aboutsummaryrefslogtreecommitdiff
path: root/helix-core/src/register.rs
diff options
context:
space:
mode:
Diffstat (limited to 'helix-core/src/register.rs')
-rw-r--r--helix-core/src/register.rs21
1 files changed, 21 insertions, 0 deletions
diff --git a/helix-core/src/register.rs b/helix-core/src/register.rs
new file mode 100644
index 00000000..0be0ce89
--- /dev/null
+++ b/helix-core/src/register.rs
@@ -0,0 +1,21 @@
+use crate::Tendril;
+use once_cell::sync::Lazy;
+use std::{collections::HashMap, sync::RwLock};
+
+// TODO: could be an instance on Editor
+static REGISTRY: Lazy<RwLock<HashMap<char, Vec<String>>>> =
+ Lazy::new(|| RwLock::new(HashMap::new()));
+
+pub fn get(register: char) -> Option<Vec<String>> {
+ let registry = REGISTRY.read().unwrap();
+
+ // TODO: no cloning
+ registry.get(&register).cloned()
+}
+
+// restoring: bool
+pub fn set(register: char, values: Vec<String>) {
+ let mut registry = REGISTRY.write().unwrap();
+
+ registry.insert(register, values);
+}