Swap system and primary clipboard registers (#8703)
This commit is contained in:
parent
a069b92897
commit
1755c61d08
|
@ -75,8 +75,8 @@ pub fn read<'a>(&'a self, name: char, editor: &'a Editor) -> Option<RegisterValu
|
||||||
self.clipboard_provider.as_ref(),
|
self.clipboard_provider.as_ref(),
|
||||||
self.inner.get(&name),
|
self.inner.get(&name),
|
||||||
match name {
|
match name {
|
||||||
'*' => ClipboardType::Clipboard,
|
'+' => ClipboardType::Clipboard,
|
||||||
'+' => ClipboardType::Selection,
|
'*' => ClipboardType::Selection,
|
||||||
_ => unreachable!(),
|
_ => unreachable!(),
|
||||||
},
|
},
|
||||||
)),
|
)),
|
||||||
|
@ -95,8 +95,8 @@ pub fn write(&mut self, name: char, mut values: Vec<String>) -> Result<()> {
|
||||||
self.clipboard_provider.set_contents(
|
self.clipboard_provider.set_contents(
|
||||||
values.join(NATIVE_LINE_ENDING.as_str()),
|
values.join(NATIVE_LINE_ENDING.as_str()),
|
||||||
match name {
|
match name {
|
||||||
'*' => ClipboardType::Clipboard,
|
'+' => ClipboardType::Clipboard,
|
||||||
'+' => ClipboardType::Selection,
|
'*' => ClipboardType::Selection,
|
||||||
_ => unreachable!(),
|
_ => unreachable!(),
|
||||||
},
|
},
|
||||||
)?;
|
)?;
|
||||||
|
@ -118,8 +118,8 @@ pub fn push(&mut self, name: char, mut value: String) -> Result<()> {
|
||||||
'#' | '.' | '%' => Err(anyhow::anyhow!("Register {name} does not support pushing")),
|
'#' | '.' | '%' => Err(anyhow::anyhow!("Register {name} does not support pushing")),
|
||||||
'*' | '+' => {
|
'*' | '+' => {
|
||||||
let clipboard_type = match name {
|
let clipboard_type = match name {
|
||||||
'*' => ClipboardType::Clipboard,
|
'+' => ClipboardType::Clipboard,
|
||||||
'+' => ClipboardType::Selection,
|
'*' => ClipboardType::Selection,
|
||||||
_ => unreachable!(),
|
_ => unreachable!(),
|
||||||
};
|
};
|
||||||
let contents = self.clipboard_provider.get_contents(clipboard_type)?;
|
let contents = self.clipboard_provider.get_contents(clipboard_type)?;
|
||||||
|
@ -172,8 +172,8 @@ pub fn iter_preview(&self) -> impl Iterator<Item = (char, &str)> {
|
||||||
('#', "<selection indices>"),
|
('#', "<selection indices>"),
|
||||||
('.', "<selection contents>"),
|
('.', "<selection contents>"),
|
||||||
('%', "<document path>"),
|
('%', "<document path>"),
|
||||||
('*', "<system clipboard>"),
|
('+', "<system clipboard>"),
|
||||||
('+', "<primary clipboard>"),
|
('*', "<primary clipboard>"),
|
||||||
]
|
]
|
||||||
.iter()
|
.iter()
|
||||||
.copied(),
|
.copied(),
|
||||||
|
@ -190,8 +190,8 @@ pub fn remove(&mut self, name: char) -> bool {
|
||||||
match name {
|
match name {
|
||||||
'*' | '+' => {
|
'*' | '+' => {
|
||||||
self.clear_clipboard(match name {
|
self.clear_clipboard(match name {
|
||||||
'*' => ClipboardType::Clipboard,
|
'+' => ClipboardType::Clipboard,
|
||||||
'+' => ClipboardType::Selection,
|
'*' => ClipboardType::Selection,
|
||||||
_ => unreachable!(),
|
_ => unreachable!(),
|
||||||
});
|
});
|
||||||
self.inner.remove(&name);
|
self.inner.remove(&name);
|
||||||
|
|
Loading…
Reference in a new issue