mirror of https://github.com/helix-editor/helix
You cannot select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
21 lines
632 B
Rust
21 lines
632 B
Rust
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()));
|
|
|
|
/// Read register values.
|
|
pub fn get(register_name: char) -> Option<Vec<String>> {
|
|
let registry = REGISTRY.read().unwrap();
|
|
registry.get(®ister_name).cloned() // TODO: no cloning
|
|
}
|
|
|
|
/// Read register values.
|
|
// restoring: bool
|
|
pub fn set(register_name: char, values: Vec<String>) {
|
|
let mut registry = REGISTRY.write().unwrap();
|
|
registry.insert(register_name, values);
|
|
}
|