mirror of
https://github.com/ilyakooo0/helix.git
synced 2024-09-11 16:07:00 +03:00
Implement black hole register (#1165)
This commit is contained in:
parent
103b5125e4
commit
1d773bcefb
@ -23,8 +23,10 @@ ### Special Registers
|
||||
| `/` | Last search |
|
||||
| `:` | Last executed command |
|
||||
| `"` | Last yanked text |
|
||||
| `_` | Black hole |
|
||||
|
||||
> There is no special register for copying to system clipboard, instead special commands and keybindings are provided. See the [keymap](keymap.md#space-mode) for the specifics.
|
||||
> The black hole register works as a no-op register, meaning no data will be written to / read from it.
|
||||
|
||||
## Surround
|
||||
|
||||
|
@ -15,7 +15,11 @@ pub const fn new(name: char) -> Self {
|
||||
}
|
||||
|
||||
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 @@ pub fn read(&self) -> &[String] {
|
||||
}
|
||||
|
||||
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);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user