diff options
author | ath3 | 2021-11-28 01:21:40 +0000 |
---|---|---|
committer | GitHub | 2021-11-28 01:21:40 +0000 |
commit | 1d773bcefb40f69fe31dc048bfbdd83601fe0e62 (patch) | |
tree | 2c3586e412619f4c1d71b36f2ac9202281f00dea /helix-core/src | |
parent | 103b5125e4bc51965d98a38cdbeed2151ed816fa (diff) |
Implement black hole register (#1165)
Diffstat (limited to 'helix-core/src')
-rw-r--r-- | helix-core/src/register.rs | 14 |
1 files changed, 11 insertions, 3 deletions
diff --git a/helix-core/src/register.rs b/helix-core/src/register.rs index c5444eb7..b9eb497d 100644 --- a/helix-core/src/register.rs +++ b/helix-core/src/register.rs @@ -15,7 +15,11 @@ impl Register { } pub fn new_with_values(name: char, values: Vec<String>) -> Self { - Self { name, values } + if name == '_' { + Self::new(name) + } else { + Self { name, values } + } } pub const fn name(&self) -> char { @@ -27,11 +31,15 @@ impl Register { } pub fn write(&mut self, values: Vec<String>) { - self.values = values; + if self.name != '_' { + self.values = values; + } } pub fn push(&mut self, value: String) { - self.values.push(value); + if self.name != '_' { + self.values.push(value); + } } } |