aboutsummaryrefslogtreecommitdiff
path: root/helix-core/src
diff options
context:
space:
mode:
Diffstat (limited to 'helix-core/src')
-rw-r--r--helix-core/src/register.rs14
1 files changed, 7 insertions, 7 deletions
diff --git a/helix-core/src/register.rs b/helix-core/src/register.rs
index cc881a17..c3e6652e 100644
--- a/helix-core/src/register.rs
+++ b/helix-core/src/register.rs
@@ -22,13 +22,17 @@ impl Register {
self.name
}
- pub fn read(&self) -> &Vec<String> {
+ pub fn read(&self) -> &[String] {
&self.values
}
pub fn write(&mut self, values: Vec<String>) {
self.values = values;
}
+
+ pub fn push(&mut self, value: String) {
+ self.values.push(value);
+ }
}
/// Currently just wraps a `HashMap` of `Register`s
@@ -42,11 +46,7 @@ impl Registers {
self.inner.get(&name)
}
- pub fn get_mut(&mut self, name: char) -> Option<&mut Register> {
- self.inner.get_mut(&name)
- }
-
- pub fn get_or_insert(&mut self, name: char) -> &mut Register {
+ pub fn get_mut(&mut self, name: char) -> &mut Register {
self.inner
.entry(name)
.or_insert_with(|| Register::new(name))
@@ -57,7 +57,7 @@ impl Registers {
.insert(name, Register::new_with_values(name, values));
}
- pub fn read(&self, name: char) -> Option<&Vec<String>> {
+ pub fn read(&self, name: char) -> Option<&[String]> {
self.get(name).map(|reg| reg.read())
}
}